Displaying List of Patterns in Linux bash shell programming UNIX bash script Command ls

In these bash shell programming it has the three choice first option to display with .c extension, second option is display the special character, final third option to display the specific file type extension. It will perform by using Linux UNIX basic command ls. Ls –l *.c, it will display files with .c extension files just like it will perform the third option.
Source code bash shell Programming Algorithm
echo "Display list of files"
echo "1)Display files with .c extension"
echo "2)Display special character"
echo "3)Displaying list of files by specifying starting character"
echo "choice"
read a
case $a in
1)echo "List.c files"
ls -l *.c;;
2)echo "Displaying special character"
echo \!\#\@\$\%\^\&;;
3)echo "Displaying list of files by specifying starting character"
read s
echo ls $s*;;
*)echo "invvalid"
esac

OUPUT CS1252 Operating Systems lap
[redhat35@localhost Rhel5]$ sh patterns.sh
Display list of files
1)Display files with .cextension
2)Display special character
3)Displaying list of files by specifying starting character
choice
2
Displaying special character
!#@$%^&

[redhat35@localhost Rhel5]$ sh patterns.sh
Display list of files
1)Display files with .cextension
2)Display special character
3)Displaying list of files by specifying starting character
choice
3
Displaying list of files by specifying starting character
f
fcfs.c file.c file.sh fib.sh fact.sh

Post a Comment

0 Comments