Check input device is a terminal: Difference between revisions

m (moved Categorys to top / Category:Hardware)
Line 231:
echo "Input is NOT a terminal"
fi</lang>
 
=={{header|zkl}}==
On Unix, check to see if stdin's st_mode is a character device.
<lang zkl>const S_IFCHR=0x2000;
fcn S_ISCHR(f){ f.info()[4].bitAnd(S_IFCHR).toBool() }
S_ISCHR(File.stdin).println();</lang>
{{out}}
<pre>
$ zkl bbb # from the command line
True
$ zkl bbb < bbb.zkl
False
$ cat bbb.zkl | zkl bbb
False
</pre>
Anonymous user