End-of-file character (was script > mumble)

Maarten Litmaath maart at cs.vu.nl
Tue Oct 11 05:32:22 AEST 1988


In article <503 at quintus.UUCP> ok at quintus.UUCP (Richard A. O'Keefe) writes:
\... here's some source code:
[C source deleted]

People, what happened to good old shell script programming?

BSD:
sh -c 'stty all 2> /tmp/stty.$$; set `tail -1 /tmp/stty.$$`;
	shift; shift; echo $9; /bin/rm /tmp/stty.$$'
----------------------------------------------------------------------------
SysV:
sh -c 'stty -a | sed -e "s/.*eof = \([^;]*\).*/\1/" -e q'
----------------------------------------------------------------------------

BTW, this shows the SysV stty(1) command is favorable in one way: if stdout
isn't a tty, try stderr or stdin! (So we won't need the stupid temp file.)
-- 
Hippic sport:                         |Maarten Litmaath @ Free U Amsterdam:
             a contradiction in terms.|maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.wizards mailing list