This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$NUMBER=100 | |
if [ $NUMBER -eq 100 ] ; then | |
echo “Number is equal” | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ “Foo” == “Foo” ] ; then | |
echo “Its equal” | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ls ; then | |
echo “listed all the files” | |
else | |
echo “error” | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ test-commands ]; then | |
#do something | |
elif [ more-commands ]; then | |
#do more something] | |
else | |
#do something else | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print the third value in the array | |
echo ${MY_ARRAY[2]} | |
# To print everyting in the array: | |
echo ${MY_ARRAY[@]} | |
# Get array length | |
echo ${#MY_ARRAY[@]} | |
# Add more elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MY_ARRAY[0]=“Laks” | |
MY_ARRAY[1]=“Torsk” | |
MY_ARRAY[2]=“Sild” | |
MY_ARRAY[3]=“Flyndre” | |
# or | |
SECOND_ARRAY=(laks torsk sild "Enda en laks") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MYVAR_1=$(expr 1 + 1) | |
MYVAR_2=`expr 1 + 1` | |
# MYVAR_1 and MYVAR_2 are 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MY_INT=2 | |
MY_INT=`expr $MY_INT + 1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MYVAR=“pewpew”; | |
echo $MYVAR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./helloworld.sh |