开发者

Bash read and stderr redirection

So I've got a script that runs test cases on another script. I'm trying to redirect stderr while running the test cases. The part that is giving me pr开发者_StackOverflowoblems is the read command:

within script1:

read -p "Delete $file? (y/n) " input

within testscript:

$script $opts $file 2>/dev/null

The read calls from script1 get redirected as well.


Redirect the prompt to stdout.

read -p "Delete $file? (y/n) " input 2>&1


You can go simple:

echo "Delete $file? (y/n)"
read input
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜