[vox-tech] Re: quick, stupid bash question

vox-tech@lists.lugod.org vox-tech@lists.lugod.org
Wed, 29 May 2002 22:34:55 -0400


  Blah, I joined two different output runs and grabbed the wrong parts.

>   Where "HERE" is above things are swapped.  Sample follows...
> 
> msimons@star:~/debian$ cat ascript
> #! /bin/bash
> echo "something on stderr" 1>&2
> echo "something on stdout"
> msimons@star:~$ ./ascript
> something on stderr
> something on stdout
> msimons@star:~$ ./ascript > /dev/null
> something on stderr
> msimons@star:~$ ./ascript 2> /dev/null
> something on stdout
msimons@star:~$ ( ./ascript 3>&2 2>&1 1>&3 ) 2> /dev/null
something on stderr
msimons@star:~$ ( ./ascript 3>&2 2>&1 1>&3 ) 1> /dev/null
something on stdout
msimons@star:~$ 

  You can see from the last two sample that "2> /dev/null" throws
away the scripts command's stdout...