postheadericon write a shell script to fetch the data from a file and display data into another file in reverse order.

echo "Enter File Name : \c "
read fileName



if [ -f $fileName ]
then
str=`cat $fileName`

len=`echo $str|wc -c`

i=$len
while [ $i -ge 1 ]
do
temp=$temp`echo $str|cut -c $i`
i=`expr $i - 1`
done

echo $temp>Result_ex2f.txt
cat Result_ex2f.txt

else
echo "file [ $fileName ] not exist in \c "
pwd
fi


0 comments:

Follow by Email

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.