linux-tutorial/codes/shell/示例脚本/逻辑控制/使用elif.sh

20 lines
357 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
# looking for a possible value
if [ $USER = "tiandi" ]
2019-10-10 08:56:31 +08:00
then
echo "Welcome $USER"
echo "Please enjoy your visit"
2019-05-10 11:17:57 +08:00
elif [ $USER = testing ]
then
2019-10-10 08:56:31 +08:00
echo "Welcome $USER"
echo "Please enjoy your visit"
2019-05-10 11:17:57 +08:00
elif [ $USER = barbar ]
then
2019-10-10 08:56:31 +08:00
echo "Do not forget to logout when you're done"
2019-05-10 11:17:57 +08:00
else
2019-10-10 08:56:31 +08:00
echo "Sorry, you are not allowed here"
2019-05-10 11:17:57 +08:00
fi