ERROR: wrong args ( > ) when redirecting output from an init script
While writing a script to help ease maintenance of my Gentoo installation (i.e. the portage tree) I came across the following error when trying to redirect the standard output of stopping/starting the rsync deamon
/etc/init.d/rsyncd stop > /dev/null ..stopping rsyncd.. * ERROR: wrong args ( > )
The line in the script was:
$SUDO /etc/init.d/rsyncd stop $QUIET_REDIRECT
Turns out you need to do something like the following:
eval "$SUDO /etc/init.d/rsyncd stop $QUIET_REDIRECT"