I have a find command with multiple -exec arguments and would like the output (both stdout and stderr) for one of the commands to be suppressed. When I use &>/path/to/file, it sends the process to the background instead of redirecting output.
find /some/path -type f -exec sh -c 'scriptA.sh "$1"' _ "{}" \; -exec sh -c 'scriptB.sh "$1" &>/dev/null' _ "{}" \;
I found a way around it by using the command below (which also uses the '&' character), but I would like to know why it sends the process to the background instead of redirecting output like it normally would. So why does the command below work, but the one above does not?
find /some/path -type f -exec sh -c 'scriptA.sh "$1"' _ "{}" \; -exec sh -c 'scriptB.sh "$1" >/dev/null 2>&1' _ "{}" \;
Thanks!