Write a shell script that accepts any number of arguments and prints them in the reverse order. Script: a=$# echo "Number of arguments are" $a x=$* c=$a res='' while [ 1 -le $c ] do c=`expr $c - 1` shift $c res=$res' '$1 set $x done echo Arguments in reverse order $res Output: sh 1prg.sh a b c No of arguments are 3 Arguments in reverse order c b a
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter