Results 1 to 6 of 6
how would i have a menu system w/ case, and pass a variable through input, like having a delete listing like
case "$var" in
"$D" )
rm whatever
;;
where ...
- 05-21-2007 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
case, menus, and passing strange var's
how would i have a menu system w/ case, and pass a variable through input, like having a delete listing like
case "$var" in
"$D" )
rm whatever
;;
where they would just type d (whatever) to use rm (whatever)
the reason i am asking is i just created a huge menu system for my vscanner (with you guy's help) but i still need my find and remove command to be able to be passed variables and still go back to the main screen. can i make it ask for them, like call "D" and have it ask "what file?" and remove it and then return to menu?
- 05-21-2007 #2
echo "To remove filename press D"
case $var in
D)
echo -n "File to delete? "
read FILENAME
rm $FILENAME
;;
Remember to set a path though, or else it will look in the current directory. Not so nice if it's running in /bin
- 05-21-2007 #3Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
it is a seek and destroy command. will this work?
echo "To remove filename press D"
case $var in
D)
echo -n "File to delete? "
read FILENAME
find / -iname $filename -exec rm -rv {} \;
;;
- 05-21-2007 #4
For a more efficient deletion I recommend this as last line:
rm `find / -name $FILENAME`
Happy hunting
- 05-21-2007 #5
- 05-22-2007 #6Just Joined!
- Join Date
- Nov 2006
- Posts
- 90
thanks guys that works great


Reply With Quote
