On Tue, Jul 22, 2008 at 3:37 PM, Wade Preston Shearer <[EMAIL PROTECTED]> wrote: > In my cron tab, I was using &> to direct output to /dev/null. I want to make > sure I understand the synxtax. I was told that 1> and 2> could be used to > redirect more specifically; 1> being the output and 2> being errors. Is that > correct? Does &> catch both?, so the only reason to use 1> and 2> would be > if I want the two types to go to two different log files?
The available redirection operators depend on which shell your cron program uses to execute commands. Once upon a time, /bin/sh was the standard shell for such tasks. I don't know if newer cron variants stick to that convention. For /bin/sh, the typical syntax to send stderr to the same place as stdout is "2>&1". That form basically says: dup the current stdout descriptor onto stderr, which has one important caveat: the order of redirection operators matters. As described in the sh man page, ">file1 2>&1" doesn't do the same thing as "2>&1 >file1" because in the former stdout is redirected before stderr is duped whereas in the latter stderr is sent to the previous stdout (before stdout was redirected). Chris /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
