command 2> /dev/null
Thanks in advance,
Bhat
> What is the easiest way to redirect the standard error to a null file
> in C-shell? I am looking for something akin to what we do in ksh:
>
> command 2> /dev/null
>
Can't be done. That's one of C shell limitations. Check "Csh Programming
Considered Harmful" for more of it at
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
Bye, Dragan
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
You can't do it directly, but there are workarounds.
If stdout happens to be /dev/tty, you can use:
( command > /dev/tty ) >& /dev/null
Or you can do this:
sh -c 'command 2> /dev/null'
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
> Can't be done. That's one of C shell limitations. Check "Csh
Programming
> Considered Harmful" for more of it at
>
> http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
>
>
> Bye, Dragan
>
>
There is one thing about C-shell that I really like and that is the
Variable Modifier feature. I mean:
:h >>-->> Remove a trailing pathname component, leaving the head
[similar to dirname]
:t >>-->> Remove all leading pathname components, leaving the tail
[similar to basename]
And my personal favorites...
:r >>-->> Remove a trailing extension, leaving the root
:e >>-->> Remove all but the extension
Is there a good equivalent for :r or :e in non C-shell shells?
Thanks,
Bhat
> Dragan Cvetkovic wrote:
>
>> Can't be done. That's one of C shell limitations. Check "Csh Programming
>> Considered Harmful" for more of it at
>>
>> http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
>>
>>
>> Bye, Dragan
>>
>>
>
> There is one thing about C-shell that I really like and that is the
> Variable Modifier feature. I mean:
Bash can do those things in a more generic way.
> :h >>-->> Remove a trailing pathname component, leaving the head
> [similar to dirname]
${var%/*}
> :t >>-->> Remove all leading pathname components, leaving the tail
> [similar to basename]
${var##*/}
> And my personal favorites...
>
> :r >>-->> Remove a trailing extension, leaving the root
${var%.*}
> :e >>-->> Remove all but the extension
${var##*.}
> Is there a good equivalent for :r or :e in non C-shell shells?
See above.
--
Måns Rullgård
m...@inprovide.com
> Dragan Cvetkovic wrote:
> There is one thing about C-shell that I really like and that is the
> Variable Modifier feature. I mean:
>
> :h >>-->> Remove a trailing pathname component, leaving the head
> [similar to dirname]
>
> :t >>-->> Remove all leading pathname components, leaving the tail
> [similar to basename]
>
> And my personal favorites...
>
> :r >>-->> Remove a trailing extension, leaving the root
> :e >>-->> Remove all but the extension
>
>
> Is there a good equivalent for :r or :e in non C-shell shells?
:r ${var%.*}
:e ${var##*.}
are reasonable approximations.
mr> Bash can do those things in a more generic way.
The %, %%, #, and ## modifiers are not bash-specific: they're defined in
the POSIX spec for sh.
--
-------------------------------------------------------------------------------
Paul D. Smith <psm...@nortel.com> HASMAT--HA Software Mthds & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
> %% Måns Rullgård <m...@inprovide.com> writes:
>
> mr> Bash can do those things in a more generic way.
>
> The %, %%, #, and ## modifiers are not bash-specific: they're defined in
> the POSIX spec for sh.
Thanks for the clarification. I wasn't sure it was POSIX, and wanted
to avoid being corrected in the other direction.
--
Måns Rullgård
m...@inprovide.com