zsh shell 问题,特别是在我尝试获取输出时
zsh shell problem specifically when I am trying to get output
read -p "Enter your name: " NAME
echo "Hello $NAME, nice to meet you".```
In terminal:
ks@USER 桌面 % ./script.sh
./script.sh:read:18: -p: 无协同处理
你好,很高兴认识你。
[picture of the problem ][1]
[1]: https://i.stack.imgur.com/ZpVri.png
在 ZSH 中 -p
并不像 Bash 中那样意味着提示。见 man zshbuiltins
:
read [ -rszpqAclneE ] [ -t [ num ] ] [ -k [ num ] ] [ -d delim ]
(...)
-p Input is read from the coprocess.
使用 ZSH 实现 read
获得提示:
$ read "?Enter your name: " NAME
Enter your name: myname
$ echo $NAME
myname
read -p "Enter your name: " NAME
echo "Hello $NAME, nice to meet you".```
In terminal:
ks@USER 桌面 % ./script.sh ./script.sh:read:18: -p: 无协同处理 你好,很高兴认识你。
[picture of the problem ][1]
[1]: https://i.stack.imgur.com/ZpVri.png
在 ZSH 中 -p
并不像 Bash 中那样意味着提示。见 man zshbuiltins
:
read [ -rszpqAclneE ] [ -t [ num ] ] [ -k [ num ] ] [ -d delim ]
(...)
-p Input is read from the coprocess.
使用 ZSH 实现 read
获得提示:
$ read "?Enter your name: " NAME
Enter your name: myname
$ echo $NAME
myname