* 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

where $QUIET_REDIRECT=”> /dev/null”

Turns out you need to do something like the following:

 eval "$SUDO /etc/init.d/rsyncd stop $QUIET_REDIRECT"

If anyone knows exactly why, please let me know :) email-lclsync at domain name.

Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.