mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-05 06:18:32 +00:00
improve if on bash
This commit is contained in:
parent
96055ac7a5
commit
e1c34ca138
@ -59,11 +59,12 @@ read NAME # Note that we didn't need to declare new variable
|
|||||||
echo Hello, $NAME!
|
echo Hello, $NAME!
|
||||||
|
|
||||||
# We have the usual if structure:
|
# We have the usual if structure:
|
||||||
if true
|
# use 'man test' for more info about conditionals
|
||||||
|
if [ $NAME -ne $USER ]
|
||||||
then
|
then
|
||||||
echo "This is expected"
|
echo "Your name is you username"
|
||||||
else
|
else
|
||||||
echo "And this is not"
|
echo "Your name isn't you username"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# There is also conditional execution
|
# There is also conditional execution
|
||||||
|
Loading…
Reference in New Issue
Block a user