View Single Post

  #3 (permalink)  
Old 02-21-2007, 12:32 PM
shankar100 shankar100 is offline
Junior Member
User
 
Join Date: Dec 2006
Location: Hyderabad,India.
Posts: 16
Rep Power: 0
shankar100
Send a message via Yahoo to shankar100
Default

Quote:
Originally Posted by nixcraft
Hello shankar,

Here is the script

Code:
#!/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
Thank you, works fine
Reply With Quote