ACCESS FILE USING SWITCH CASE

SOURCE CODE:
echo "Menu"
echo "1.Enter 1 to display the long list of file"
echo "2.Enter 2 to display the long listing file including hidden file"
echo "3.Enter 3 to delete file"
read choice
case $choice in
1)ls;;
2)ls -all;;
3)echo "Enter file to be removed"
read a
echo "File deleted"
rm $a;;
*)echo "Invalid choice"
esac

OUTPUT:
[examuser35@localhost Jebastin]$ sh file.sh
Menu
1.Enter 1 to display the long list of file
2.Enter 2 to display the long listing file including hidden file
3.Enter 3 to delete file
3
Enter file to be removed
multable.sh
File deleted

[examuser35@localhost Jebastin]$ sh file.sh
Menu
1.Enter 1 to display the long list of file
2.Enter 2 to display the long listing file including hidden file
3.Enter 3 to delete file
1
palindrome.sh     mtable.sh    pattern.sh    shell.sh    employee.sh   roundrobin.c   robin.c bankers.c
amstrong.sh     fibonacci.sh      mubeen.sh     filepermission.sh    prime.sh    producer.c   banker.c
arithmetic.sh     file.sh      multiplication.sh     semaphore.c    display.sh     ls.sh    shortestjob.c
 factorial.sh   girls        pattern1.sh     fact.sh        greatest.sh  pattern2.sh        round.c    job.c     vegitables.sh     filetype.sh     wait.sh   fcfs.c         linux.sh     pattern3.sh    roundrobin.sh  first.c   simpleinterest.sh    armstrong.sh   access.sh   bubblesort.sh   leapyear.sh  patterns.sh    swapping.sh   fork.sh  exec.sh  getpid.sh  sleep.sh   filemanipulation.sh   directorymanipulation.sh   manipulation.sh  grep.sh  consumer.c bestfit.c  firstfit.c  worstfit.c  paging.c   page.c   replacement.c    best.c worst.c pagereplacement.c  segmentation.c
Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: