Hmm standard command not working as expected (SOLVED)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

Hmm standard command not working as expected (SOLVED)

#1 Post 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 ????
Last edited by tasmod on Wed 21 Jul 2010, 13:16, edited 1 time in total.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Shep
Posts: 878
Joined: Sat 08 Nov 2008, 07:55
Location: Australia

Re: Hmm standard command not working as expected

#2 Post 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

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#3 Post 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.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Post Reply