Last active
October 20, 2015 15:33
-
-
Save rytoj/1e90b160d302260ccbb1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#Test for less than 1 parameter | |
if (( $# < 1));then | |
echo "Usage $0 <name>" | |
exit 1 | |
fi | |
echo "Hello $1" | |
exit 0 | |
###################################################### | |
#Ingrementinimas per argumentus kartu so for loopu | |
#./test.sh pirmas antras | |
count=1 | |
#Seka iki 10 su 'seq' komanda | |
#for x in $(seq 1 10) | |
for x in $* | |
do | |
if [ $count -lt 2 ] ;then | |
echo $x" yra zmogus" | |
else | |
echo $x" yra hakeris" | |
fi | |
#arba ((count++)) | |
count=`expr $count + 1 ` | |
done | |
###################################################### | |
#While loop'as | |
COUNT=5 | |
while (( COUNT > 0 )) | |
do | |
echo -e "$COUNT \c" | |
sleep 1 | |
(( COUNT -- )) | |
done | |
echo -e "\nPabaiga" | |
###################################################### | |
#exit parametro tikrinimas | |
if (( $? )); then | |
{ | |
echo kaida $?; | |
exit; | |
} | |
fi; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment