An odd difference between "cat file" and "cat<file"

David Korn dgk at ulysses.UUCP
Sun Apr 22 08:47:41 AEST 1984


In the Bourne shell the command
	echo > file file1 file2
means the same as
	echo file1 file2 > file
so that if
	echo >  file*
were allowed then should it be interpretted as
echo > file file1 file2
as described above or as
echo > "file file1 file2"
as if the expansion generated the file name?
The former interepretation is difficult to implement since the command
has bee parsed and io arguments have been separated from command arguments
by the time this decision must be made.

The Bourne shell gets around this ambiguity by not doing file name generation
on i/o arguments, or parameter assignments, just on command arguments.

The Korn shell, ksh , which attempts to be friendlier, will perform the
expansion only if a unique file name is generated.



More information about the Comp.unix mailing list