Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- dialog --menu "List file of a directory" 10 30 3 1 /home 2 /root 3 /tmp 2>temp
- # OK is pressed
- if [ "$?" = "0" ]
- then
- _return=$(cat temp)
- # /home is selected
- if [ "$_return" = "1" ]
- then
- dialog --title "List file of directory /home" --msgbox "$(ls /home -l)" 100 100
- fi
- # /root is selected
- if [ "$_return" = "2" ]
- then
- dialog --title "List file of directory /root" --msgbox "$(ls /root -l)" 100 100
- fi
- # /tmp is selected
- if [ "$_return" = "3" ]
- then
- dialog --title "List file of directory /tmp" --msgbox "$(ls /tmp -l)" 100 100
- fi
- # Cancel is pressed
- else
- echo "Cancel is pressed"
- fi
- # remove the temp file
- rm -f temp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement