i am trying to write a script which it echos its script file name and the value of its odd arguments.
i got the echo filename part..but im not sure how to echo its odd arguements.
for example
the output of script Good_script is a very good script
should be
Good_script
is
very
script
i have came up with code
Code:
#!/bin/sh
filename=`basename $0`;
echo $filename;
i=1
until [ $i -gt $# ]
do
y=`echo "$i % 2" | bc`
if [ $y -eq 1 ]; then
echo $i
fi
i=`echo "$i + 1" | bc`
done
but right now, it only echos the filename and the numerical value
say if it was Good_script a b c d e
it would output
Good_script
1
3
5
any help?