开发者

Bash read and stderr redirection

开发者 https://www.devze.com 2023-03-06 00:50 出处:网络
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:

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

精彩评论

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