Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #!/bin/sh
  2. dialog --menu "List file of a directory" 10 30 3 1 /home 2 /root 3 /tmp 2>temp
  3.  
  4.  
  5. # OK is pressed
  6. if [ "$?" = "0" ]
  7. then
  8. _return=$(cat temp)
  9.  
  10. # /home is selected
  11. if [ "$_return" = "1" ]
  12. then
  13. dialog --title "List file of directory /home" --msgbox "$(ls /home -l)" 100 100
  14. fi
  15.  
  16. # /root is selected
  17. if [ "$_return" = "2" ]
  18. then
  19. dialog --title "List file of directory /root" --msgbox "$(ls /root -l)" 100 100
  20. fi
  21.  
  22. # /tmp is selected
  23. if [ "$_return" = "3" ]
  24. then
  25. dialog --title "List file of directory /tmp" --msgbox "$(ls /tmp -l)" 100 100
  26. fi
  27.  
  28. # Cancel is pressed
  29. else
  30. echo "Cancel is pressed"
  31. fi
  32.  
  33. # remove the temp file
  34. rm -f temp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement