Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- TMPFILE="/tmp/filename.txt"
- dialog --title "Input - Delete a file" --backtitle "Welcome to Linux delete" --inputbox "Enter delete file name" 8 60 2>$TMPFILE
- sel=$?
- out=$(cat $TMPFILE)
- if [ ! -f $out ]; then
- echo "Fie $out does not exists"
- exit 1
- else
- case $sel in
- 0) /bin/rm $out; echo "File $out has been deleted";;
- 1) echo "You pressed cancel";;
- 255) echo "You pressed ESC";;
- esac
- fi
- /bin/rm $TMPFILE
Advertisement
Add Comment
Please, Sign In to add comment