当前位置: 技术问答>linux和unix
一个关于CASE的问题,怎么引起死循环了呢?
来源: 互联网 发布时间:2016-03-06
本文导语: ******************************** case $1 in y) echo you say yes ;; n) echo you say no ;; *) echo $PATH ;; esac ******************************** ---以上正文---- 怎么会...
********************************
case $1 in
y) echo you say yes
;;
n) echo you say no
;;
*) echo $PATH
;;
esac
********************************
---以上正文----
怎么会引起死循环呢??
case $1 in
y) echo you say yes
;;
n) echo you say no
;;
*) echo $PATH
;;
esac
********************************
---以上正文----
怎么会引起死循环呢??
|
你从你贴出来的来看是没什么问题的,如果引起了死循环,那应该是其他地方的问题。
最好多贴出来些。
最好多贴出来些。
|
怎么会呢?
[code=BatchFile]
mymtom@x4100:src/tmp$ cat 0305_01
#! /bin/sh
case $1 in
y) echo you say yes
;;
n) echo you say no
;;
*) echo $PATH
;;
esac
mymtom@x4100:src/tmp$ ./0305_01
/home/c/r/mymtom/local/bin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/SunStudio_11/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:.:/tmp/mymtom/local/bin:/tmp/mymtom/bin
mymtom@x4100:src/tmp$ ./0305_01 y
you say yes
mymtom@x4100:src/tmp$ ./0305_01 n
you say no
mymtom@x4100:src/tmp$ ./0305_01 hello
/home/c/r/mymtom/local/bin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/SunStudio_11/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:.:/tmp/mymtom/local/bin:/tmp/mymtom/bin
[/code]
[code=BatchFile]
mymtom@x4100:src/tmp$ cat 0305_01
#! /bin/sh
case $1 in
y) echo you say yes
;;
n) echo you say no
;;
*) echo $PATH
;;
esac
mymtom@x4100:src/tmp$ ./0305_01
/home/c/r/mymtom/local/bin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/SunStudio_11/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:.:/tmp/mymtom/local/bin:/tmp/mymtom/bin
mymtom@x4100:src/tmp$ ./0305_01 y
you say yes
mymtom@x4100:src/tmp$ ./0305_01 n
you say no
mymtom@x4100:src/tmp$ ./0305_01 hello
/home/c/r/mymtom/local/bin:/usr/bin:/usr/local/bin:/usr/local/mysql/bin:/opt/SunStudio_11/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:.:/tmp/mymtom/local/bin:/tmp/mymtom/bin
[/code]