Reverse A Sentence Word Wise

Write A Shell Script To Reverse A Sentence Word Wise Shell Script: clear echo enter a sentence read sen set $sen n=$# for(( i=1; i<=$n; i++ )) do w=$1 l=`echo $w|wc -c` rev= for((k=1;k<=$l;k++)) do c=`echo $w|cut -c $k` rev=$c$rev done echo -n "$rev " shift 1 done OUTPUT: [admin@localhost ~]$ sh revsen.sh enter a sentence i am xyz i ma zyx

Share:

0 comments