Add if/else ex.
This commit is contained in:
14
script.sh
14
script.sh
@@ -1,12 +1,16 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [ "$name" == "Liana" ]; then
|
||||||
if [ $# -eq 0 ]; then
|
echo "Hello Liana!"
|
||||||
echo "Usage: ./script.sh <names...>"
|
exit 0
|
||||||
exit 1
|
elif [ "$name" == "Admin" ]; then
|
||||||
|
echo "Hello Admin! You have full access."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Hello $name!"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Hello, all of you: $@"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user