<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div>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.</div>
<div><br>
</div>
<div>The following snippet allows for independent stderr redirection.</div>
<div><br>
</div>
<div>( ( ( echo ok ; no ) > /dev/stdin ) >& /dev/null < /dev/stdout ) | ( echo "$<" )<br>
</div>
<div><br>
</div>
<div>Sadly, seems to break at times, resulting in blank output<span style="color: var(--textPrimary);">. Likely a bug in Tcsh or the operating system?</span></div>
<div><span style="color: var(--textPrimary);"><br>
</span></div>
<div><span style="color: var(--textPrimary);">I don't know the history on the /dev/std[in][out][err] files. How much standard are these files?</span></div>
<div><span style="color: var(--textPrimary);"><br>
</span></div>
<div><span style="color: var(--textPrimary);">Here's an example program which is difficult for the traditional method.</span></div>
<div><span style="color: var(--textPrimary);"><br>
</span></div>
<div><span style="color: var(--textPrimary);">if ( ! "$?main" ) then</span></div>
<div><span style="color: var(--textPrimary);">  set main = "$cwd/$0"</span></div>
<div><span style="color: var(--textPrimary);">  ( exit ( { ( ( ( grep ok * | \</span></div>
<div><span style="color: var(--textPrimary);">  source "$main" ) > /dev/stdin ) \</span></div>
<div><span style="color: var(--textPrimary);">  < /dev/stdout >& /dev/null ) } ) ) | \</span></div>
<div><span style="color: var(--textPrimary);">  ( set file = "$<" ; \</span></div>
<div><span style="color: var(--textPrimary);">  exit ( "$file" == ) && \</span></div>
<div><span style="color: var(--textPrimary);">  echo "$file:s/://" ) || \</span></div>
<div><span style="color: var(--textPrimary);">  exit -1</span></div>
<div><span style="color: var(--textPrimary);">  exit</span></div>
<div><span style="color: var(--textPrimary);">endif</span></div>
<div><span style="color: var(--textPrimary);"><br>
</span></div>
<div><span style="color: var(--textPrimary);">set file = "$<"</span></div>
<div><span style="color: var(--textPrimary);">while ( "$file" != )</span></div>
<div><span style="color: var(--textPrimary);">  if ( "$file" =~ "${1}:*" ) then</span></div>
<div><span style="color: var(--textPrimary);">    glob $file:x</span></div>
<div><span style="color: var(--textPrimary);">    exit 1</span></div>
<div><span style="color: var(--textPrimary);">  endif</span></div>
<div><span style="color: var(--textPrimary);">  set file = "$<"</span></div>
<div><span style="color: var(--textPrimary);">end</span></div>
</body>
</html>