Page 1 of 1

Hmm standard command not working as expected (SOLVED)

Posted: Wed 21 Jul 2010, 12:36
by tasmod
Using Puppy Lucid 213

OK I'm in the middle of a script and place the following.

Code: Select all

/sbin/iwconfig >  /tmp/iwstuff.txt
That should have re-directed stdout to the file but it doesn't, it's empty.
Backticks does nothing, trying exec closes script or closes cli !

This doesn't work in either a script or from command line. Command line does echo the output though ?

What's wrong, have I missed something ?

Just tried ifconfig > test.txt and it created a file with the stdout in it ????

Re: Hmm standard command not working as expected

Posted: Wed 21 Jul 2010, 12:55
by Shep
tasmod wrote:

Code: Select all

/sbin/iwconfig >  /tmp/iwstuff.txt
That should have re-directed stdout to the file but it doesn't, it's empty.
If iwconfig happens to be an empty file then so will be iwstuff.txt

Standard output will be directed to that file using your syntax. But if the output of iwconfig consists of both standard output and standard error, then to redirect both these outputs to a common file,

Code: Select all

/sbin/iwconfig > /tmp/iwstuff.txt 2>&1
HTH

Posted: Wed 21 Jul 2010, 13:12
by tasmod
Doh, of course.

I was so hung up on 'ifconfig' working I forgot about stderr as I have no wireless 'iwconfig' would error as well.

Thanks.