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
精彩评论