[Tcsh] Independent stderr redirection through /dev/std[in][out].
M G P
tateusg at hotmail.com
Sun Nov 19 10:29:03 UTC 2023
I've come across certain situations where the traditional sub-shell method doesn't always solve the problem of independent stderr redirection, resulting in creation of a FIFO.
The following snippet allows for independent stderr redirection.
( ( ( echo ok ; no ) > /dev/stdin ) >& /dev/null < /dev/stdout ) | ( echo "$<" )
Sadly, seems to break at times, resulting in blank output. Likely a bug in Tcsh or the operating system?
I don't know the history on the /dev/std[in][out][err] files. How much standard are these files?
Here's an example program which is difficult for the traditional method.
if ( ! "$?main" ) then
set main = "$cwd/$0"
( exit ( { ( ( ( grep ok * | \
source "$main" ) > /dev/stdin ) \
< /dev/stdout >& /dev/null ) } ) ) | \
( set file = "$<" ; \
exit ( "$file" == ) && \
echo "$file:s/://" ) || \
exit -1
exit
endif
set file = "$<"
while ( "$file" != )
if ( "$file" =~ "${1}:*" ) then
glob $file:x
exit 1
endif
set file = "$<"
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20231119/c7fa60f7/attachment.htm>
More information about the Tcsh
mailing list