[BusyBox] ASH and redirection...

Charles Steinkuehler charles at steinkuehler.net
Wed Feb 6 16:34:04 UTC 2002


This does seem to be a difference between bash and ash...looks like ash is
looking for the command before processing the redirection.

A quick work-around is to change:
xyz >/dev/null 2>&1

into:
eval xyz >/dev/null 2>&1

if possible when using ash...this works OK, but you may have some issues
with quoting, depending on what sort of arguments you're trying to pass (if
you want quotes around arguments when you the command runs, you need to
escape them in the eval command, ie:
eval xyz \"my quoted arg\" >/dev/null 2>&1

Charles Steinkuehler
charles at steinkuehler.net

----- Original Message -----
From: "Thomas Cameron" <tom at patcameron.ne.mediaone.net>
To: <busybox at busybox.net>
Sent: Wednesday, February 06, 2002 5:19 PM
Subject: [BusyBox] ASH and redirection...


Hello all,
    I have recently resumed development on one of my project systems,
and have started to write some shell scripts.  These scripts use
connemds as such:

echo "foo" > /dev/null 2>&1

    If the command succeeds or fails, I should not get any output to the
console (correct me if I'm wrong).  I should then be able to execute
`echo $?`, and get "0" returned to me, so I can check the exit code of
the previously executed program.
    The problem that I'm having is that when I execute a nonexistant
command, ash still dumps "command:No such file or directory" to the
console.  Obviously, this is a problem if I'm trying to format the
output through the script.  Is this the way things are suposed to work?
Does bash deviate from an agreed upon standard, so as not to output the
errors?  If anyone knows any information about this, please let me know.
Thanks in advance!

-Tom Cameron

P.S.  I am using the BB snapshot of the stable tree from January 05,
2002.
_______________________________________________
busybox mailing list
busybox at busybox.net
http://busybox.net/mailman/listinfo/busybox




More information about the busybox mailing list