Hellou. I like to ask you, how can I find out if some action in command working well.
For example when i have command1 | xargs -ls -lA | command2 | command3
How can I find return number of function xargs ls -lA where may be problem.
Or better, how can I redirect errors out of STDOUT (Cause when im sreaching root directory, There are ls: cannot access errors) thank you
It's unclear what you are trying to achieve, so I'll try to answer a few possibilities. I'll also limit the answers to Bash, since that is the shell of most *nix users today:
read
ing each line of output from command1
, and then using either break
or set -o errexit
to return to the appropriate level on failure.ls
command. You can do this using redirection: command1 | xargs -ls -lA 2>ls.log | command2 | command3
PIPESTATUS
.