Skip to content

Instantly share code, notes, and snippets.

Created January 12, 2013 08:10
Show Gist options
  • Save anonymous/4516697 to your computer and use it in GitHub Desktop.
Save anonymous/4516697 to your computer and use it in GitHub Desktop.
case.sh
#!/bin/bash
read -p "please input a file name:" file
cat <<- MENU
d or D:delete file
s or S:show file detail infomation
q or Q:quit
MENU
read -p "input your option:" option
case "$option" in
d|D) echo "delete $file"
rm "$file" ;;
s|S) ls -l "$file" ;;
q|Q) exit 0 ;;
*) echo "invalid option"
exit 1 ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment