Home Linux Write a shell script to display the following menu for a particular file.

Write a shell script to display the following menu for a particular file.

1 min read
0
0
53

Write a shell script to display the following menu for a particular file.

  • Display all the words of file in ascending order.
  • Display a file in descending order.
  • Display a file in reverse order.
  • Toggle all characters in the file.
  • Display the type of the file.

echo "Enter file name"

read fname

echo "1.Display all the words of a file in ascending order."

echo "2.Display file in descending order."

echo "3.Display the file in reverse order."

echo "4.Toggle all characters in the file"

echo "5.Display the type of file."

echo "Enter your chioce:\c"

read c;

case $c in

1)for i in `cat $fname`

do

echo $i>>f1.txt

done

sort f1.txt

rm f1.txt;;

2)sort -r $fname ;;

3)rev $fname;;

4)cat $fname | tr "a-z" "A-Z"

read buf;;

5)file $fname ;;

*)echo "Invalid option"

esac

 

Load More Related Articles
Load More By coder coder
Load More In Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Prime Or Not Prime vb.net Program.

Prime Or Not Prime . …