Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让bash read-p打印新行_Bash - Fatal编程技术网

如何让bash read-p打印新行

如何让bash read-p打印新行,bash,Bash,我正在使用Bash build-inread-p打印消息,并将用户输入读取到REPLY中,希望在末尾添加一行新行 read-p“please input someint\n”不起作用,它打印的是\n,而不是新行 我该怎么做 谢谢试试这个 #!/bin/bash read -p "Please input something " msg echo $msg 这将使read-p打印新行。希望这有帮助。投票否决,可能是因为它是重复的

我正在使用Bash build-in
read-p
打印消息,并将用户输入读取到REPLY中,希望在末尾添加一行新行

read-p“please input someint\n”不起作用,它打印的是
\n
,而不是新行

我该怎么做

谢谢

试试这个

#!/bin/bash

read -p "Please input something
" msg
echo $msg

这将使
read-p
打印新行。希望这有帮助。

投票否决,可能是因为它是重复的