Basically my script contains one very long command to start an application , the problem is it is generating a warning and i dont want that warning to be displayed how do i redirect the o/p of the command to a file and not to the screen so the user wont see it?
but it is giving me an error - "Bad Number"
and referencing the file name I used do i need to declare the file name as a variable ?
I tried putting it in "" but got the same error
There is somethiung basic and blatantly obvious that I am missing, very possible as Ive never coded a Cshell b4 and only a little dabble of awk/perl/bourne shell
Hi,
Maybe redirecting the output from the command to eliminate the warning isn't what is needed. Maybe you need to figure out why the warning is coming out and see if you can eliminate it from your script.
For example, if command is something like.....
ls -l *.q | grep joke
( poor example but illustrates point)
and the LS would report 'No Match' which comes out through STDERR. You can correct this by also redirecting STDERR to the GREP which will throw it away because it doesn't match the grep pattern.
ls -l *.c |& grep joke
Adding to the posts about
Most UNIX's allow you to specify all output goes to the bit bucket. ( /dev/null )
command ... >&! /dev/null
> means redirect stdout
& means redirect Stderr
! means delete the file if it already exists.
There is no way just to redirect STDERR, so if you want the stdout to come out to the user but not the stderr you need to do something like....
Thanks, but still cant redirect my errors as I need the application (STDOUT) to start anyway, I have a patch which might get rid of the warning - I'll have to try that instead
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.