linux shell编程之菜单选择

最近在学shell脚本,看了一些资料也在网上看了一些代码,自己写了一些脚本放上来和菜鸟一起学习,多谢各位的指点。

#!/bin/bash
cat << EOF
********please enter your choise:(1-6)****
(1) List you selected directory
(2) Change to you selected directory
(3) Create a new file
(4) Edit you selected file
(5) Remove you selected file.
(6) Exit Menu.
EOF
read -p "Now select the top option to: " input
case $input in
1) ls;;
2) echo "Enter target directory:"
read dir
cd $dir;;
3) echo "Enter a file name:"
read file
touch $file;;
4) echo "Enter a file name:"
read file
vi $file;;
5) echo "Enter a file nmae:"
read file
rm $file;;
esac

posted on 2012-08-16 09:43  劫近神的男人  阅读(336)  评论(0编辑  收藏  举报