首页 > 编程开发 > Shell > 正文  
写 shell script 时,要如何从 terminal 读入字元?
出自:Steve Hayman 2002年02月11日 15:18
在 sh 中,你可以用 read。通常是使用在回圈,如下例: 

        while read line 
        do 
            ... 
        done 

在 csh 中,则用 $/dev/null` 
        stty -cbreak 
        echo "Thank you for typing a $readchar ."   
】【http://www.trainlinux.com】【Close
『相关资料』
我要如何将 csh 的 stdout 与 stderr 导向到不同的地方呢? (2002-02-11 15:18)
如何在 .cshrc 中判断是否在 login shell 中? (2002-02-11 15:17)
在 Bourne shell script 里要怎么找出最后一个参数? (2002-02-11 15:14)
如何让 setuid 的 shell script 可以使用? (2002-02-11 15:14)
Home 

诚恩Linux培训工作室