An odd difference between 'cat file' - (nf)

olson at fortune.UUCP olson at fortune.UUCP
Wed Apr 18 06:09:35 AEST 1984


#R:opus:-36700:fortune:26900046:000:1105
fortune!olson    Apr 17 10:35:00 1984

>	 The reason that ``cat xyz*'' is expanded and ``cat <xyz*''
>	is not has to do with the C getchar() call.  cat takes any
>	arguments on the command line that don't start with a ``-'',
>	expands them, and interprets them as filenames.  However, if
>	you use the ``<'' before the filename, the filename is actually
>	used as stdin and the filename is not put on the command line.
>	Therefore, cat thinks that you are typing in somthing from the
>	terminal.  Hope this helps.
>					Curt Jeff Sampson
>					  alberta!jeff
This is totally mistaken, the expansion is done by the shell (in this
case the Bourne shell).  Only on non-unix systems that try to emulate
Unix, (or have a different form of wild-card expansion), do the
programs themselves do wild-card expansion.  (There are, as always,
exceptions even in programs that run under Unix.)

I suspect, but have not verified, that the Bourne shell stops
expanding wild cards after the >, <, and | chars (up to a terminal
character, be it newline, &, or ;).  (Those of you who have looked at
the sh source know why I haven't verified it -:).)
	Dave Olson



More information about the Comp.unix mailing list