使用elif

5年以前  |  阅读数:483 次  |  编程语言:Shell 
#!/bin/bash

# looking for a possible value

if [ $USER = "tiandi" ]
then 
    echo "Welcome $USER"
    echo "Please enjoy your visit"
elif [ $USER = testing ]
then
    echo "Welcome $USER"
    echo "Please enjoy your visit"
elif [ $USER = barbar ]
then
    echo "Do not forget to logout when you're done"
else
    echo "Sorry, you are not allowed here"
fi

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8