Shell Script to reverse command line arguments
Program
#Zero arguments error
if [ $# -eq 0 ]
then
echo "Can't have zero arguments!"
exit
#While parameters don't become zero, get the input and shift it
else
while [ $# -gt 0 ]
do
rev="$1 $rev"
shift
done
echo $rev
fi
Output
$ chmod 755 reverse-command-line.sh
$ sh reverse-command-line.sh 32 56 12 73
73 12 56 32