bash
and then run the bash
command).A non-interactive shell doesn’t source any startup file. It only inherits environment variables from the shell where it is called.
An interactive non-login shell only source ~/.bashrc
In this case, only ~/.bashrc
is sourced.
According to http://mywiki.wooledge.org/BashFAQ/002, it is possible to swap stdin and stderr in bash:
output=$(command 2>&1 >/dev/null) # Save stderr, discard stdout
output=$(command 2>&1 >/dev/tty) # Save stderr, stdout -> terminal
output=$(command 3>&2 2>&1 1>&3-) # Save stderr, stdout -> script's stderr
Activities mentions in this site have been supported by the following grants: