samedi 18 avril 2015

Counting down in a loop to zero by the number being given

I am using bash. I am trying to write a script that will take one number from the command line to test if there was an argument given. And if there was using loop the number given count it down to zero and must say finished. This is what I have. I cant get it to work.



if [ $# -eq "0" ] ;then
echo "No parameters given"
else
echo $#
count= $1
while [ $count -le $1 ];
var= `expr $ 1 - $count`
echo `$var`
count=count+1
end
echo "Finished"

Aucun commentaire:

Enregistrer un commentaire