On Linux, the following cd works fine so cds into tmp:
/ # cd /tmp tmp #
But this does not work (stays at root, nothing appears in /var/log/messages). Why not?
/ # cd /tmp 2>&1 | /usr/bin/logger -t Test / #
I tried with stripping off this stderr redirect but that also did not work.
My goal is to redirect all output of my script to syslog, so also if I try to CD in a directory which does not exist/permission denied/etc. Why is it not working and how to get this working?
A normal echo does print to syslog so that does work:
echo Test | /usr/bin/logger -t Test