I am trying to a different number of parameter to a script and check them but I don't know where did I go wrong?.
I wrote the following script
test.sh
#!/bin/sh
count=$#
i=1
while [ $i -le $count ]; do
echo "parameter " $i " is " ${i}
i=`expr $i + 1`
done
to be able to pass the parameter ./test.sh man fan ban pan tan to give the output
man
fan
ban
and so on
but I am getting
1
2
3
4
5
Can anybody help me.
I wrote the following script
test.sh
#!/bin/sh
count=$#
i=1
while [ $i -le $count ]; do
echo "parameter " $i " is " ${i}
i=`expr $i + 1`
done
to be able to pass the parameter ./test.sh man fan ban pan tan to give the output
man
fan
ban
and so on
but I am getting
1
2
3
4
5
Can anybody help me.