View Single Post

  #2 (permalink)  
Old 02-21-2007, 10:17 AM
nixcraft's Avatar
nixcraft nixcraft is offline
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,061
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

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
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote