[求助]为什么我感觉这两个程序相同 可是只有一个能输出正确结果啊?
发表于 : 2012-04-09 21:06
我还特意把1的格式照着2修改了几遍 可是1中的until和choice 始终是白色的 啊 2中是黄色的 只有2可以执行出正确结果~
另外,TAB键在这里有何妙用啊?
源程序代码
没学diff啊 根据我的理解弄得 也不知道是不是你们说的diff啊
另外,TAB键在这里有何妙用啊?
源程序代码
代码: 全选
#!/bin/bash
# menu shell script. samli 2004.4.19
until
echo "List Directory..........1"
echo "Change Directory........2"
echo "Edit File...............3"
echo "Remove File.............4"
echo "Exit Menu...............5"
read choice
test $choice = 5
do
case $choice in
1) ls;;
2) echo "enter target directory:"
read dir
cd $dir
;;
3) echo "enter file name:"
read file
vi $file
;;
4) echo "enter file name:"
read file
rm $file
;;
5) echo "Goodbye"
;;
*) echo "illegal option, please input again."
esac
done
没学diff啊 根据我的理解弄得 也不知道是不是你们说的diff啊
代码: 全选
l-think@ubuntu:~$ diff test3 test4
2,31c2,31
< # menu shell script. samli 2004.4.19
< until
< echo "List Directory..........1"
< echo "Change Directory........2"
< echo "Edit File...............3"
< echo "Remove File.............4"
< echo "Exit Menu...............5"
<
< read choice
< test $choice = 5
< do
< case $choice in
< 1) ls;;
< 2) echo "enter target directory:"
< read dir
< cd $dir
< ;;
< 3) echo "enter file name:"
< read file
< vi $file
< ;;
< 4) echo "enter file name:"
< read file
< rm $file
< ;;
< 5) echo "Goodbye"
< ;;
< *) echo "illegal option, please input again."
< esac
< done
---
> # menu shell script. samli 2004.4.19
> until
> echo "List Directory..........1"
> echo "Change Directory........2"
> echo "Edit File...............3"
> echo "Remove File.............4"
> echo "Exit Menu...............5"
>
> read choice
> test $choice = 5
> do
> case $choice in
> 1) ls;;
> 2) echo "enter target directory:"
> read dir
> cd $dir
> ;;
> 3) echo "enter file name:"
> read file
> vi $file
> ;;
> 4) echo "enter file name:"
> read file
> rm $file
> ;;
> 5) echo "Goodbye"
> ;;
> *) echo "illegal option, please input again."
> esac
> done
l-think@ubuntu:~$