I'm trying to hide all the stderr from users running an interactive BASH script but keep the errors in a log file. However, simple stderr redirection quite unexpectedly hides some BASH output as well that should go to stdout instead. Have tried this on two systems and got the same results (one has GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) and the other is on MacOS X).
I have a lingering suspicion that it could be caused by the
exec replacing the shell... but another built-in (
times) works as expected and outputs to stdout!
echo This will be printed to stdout, as expected
ls ThereIsNoSuchFileOnEarth # this will go to “file_log”, as expected
read –p 'User would never see this prompt and it would go to file_log. Totally unexpected.' –r -e test
species=”Daleks Raxacoricofallapatorians Judoon”
select enemy in $species;
# …code omitted as the user would never see the list. It would go into file_log again!