Operating System - HP-UX
1846649 Members
2767 Online
110256 Solutions
New Discussion

Re: different syntax for closing standard error?

 
Charles Collins
New Member

different syntax for closing standard error?

I tried the above with ksh on a sun box, and found it would not work. Apparently &1 is closed and thus cannot be referred to?

this worked for me:
$ grep abcd /abcd >&- 2>&-
$

this did not:
$ grep abcd /abcd >&- 2>&1
ksh: 1: bad file unit number
$

cheers!
2 REPLIES 2
Charles Collins
New Member

Re: different syntax for closing standard error?

Arg.

sorry. I set this as a reply to an existing question, but upon 'registration' the web site lost the pointer and simply made a new message/subject out of it.
curt larson_1
Honored Contributor

Re: different syntax for closing standard error?

instead of:
$ grep abcd /abcd >&- 2>&1

did you try

$ grep abcd /abcd 2>&1 >&-