[net.unix] Any difference between "cat file" and "cat<file"?

dave@utcsrgv.UUCP (Dave Sherman) (04/03/84)

A silly question from someone who like to squeeze every cycle possible
out of an 11/23:

Is there any reason to, or not to, have a file opened by the shell before
exec'ing a utility? For example:
	cat file		cat < file
	dd if=x of=y		dd < x > y
	lpr junk		lpr < junk

I realize that the number of keystrokes may differ, and occasionally
the utility will behave differently when it knows the file name (e.g.,
pr(1) will list the name if it knows it).

Are there any circumstances in which the shell would be faster at
opening the file? Are there any other consideration?


[I know, I know, I've just wasted more time wondering about this
 than all of UNIXdom will ever save by using one over the other...]



Dave Sherman
Toronto
-- 
 {allegra,cornell,decvax,ihnp4,linus,utzoo}!utcsrgv!dave

wessels@uthub.UUCP (Ron Wessels) (04/03/84)

[* RAID *]

    There is one significant difference that comes about if the program
in question is setuid.  Depending on the file permissions of the user and
the program owner, one of "prog file" and "prog < file" may fail, while
the other succeeds.  "uux" using a private file is one example that comes
to mind.

-- 
Ron Wessels	Computer Systems Research Group		University of Toronto
{ decvax , floyd , ihnp4 , linus , utzoo , uw-beaver }!utcsrgv!uthub!wessels

honey@down.UUCP (code 101) (04/09/84)

/* standard disclaimer */
i don't think this note ever got out, due to a certain lousy piece of
software (that you're probably running *right now*).  in re-reading it,
it hardly seems worth the trouble to post it, but what the hell ...
i'll try to jazz it up a bit.

/* another standard disclaimer */
i know i'm going to catch a lot of heat for the mere mention of
software that YOU CAN'T HAVE (because it's worth big bucks to (what
was, before the great thaw) the largest corporation in known space);
nevertheless, it's worth knowing, thus worth mentioning, albeit not
quite on point.

/* the beef */
in honey danber, the default for uux and uucp is to avoid making the
copy into SPOOL (identifying the file by reference, instead of by
value, as it were).  however, if the file is not readable when the work
files are being created, we play a game (the rules of which vary with
different versions of unix) to turn ourselves back into the real uid,
try to copy the file, then go back to the effective uid.  so the uu*
example is no longer valid (sometime in the future for you unlucky few
not with the phone company).
	peter

/* standard meta-disclaimer */
you can hit del now (unless you're running 4.2bsd, in which case you
probably don't even know what your interrupt character is; you may not
even have one, besides which, the interrupt will probably be ignored
anyway, so read on, read on, unlucky fellow (fellow-ette?).

/* final standard disclaimer */
There is no warranty of merchantability nor any warranty of fitness for
a particular purpose nor any other warranty, either express or implied,
as to the accuracy of the enclosed materials or as to their suitability
for any particular purpose.  Accordingly, Mr. Nice Guy assumes no
responsibility for their use by the recipient.   Further, Mr. Nice Guy
assumes no obligation to furnish any assistance of any kind whatsoever,
or to furnish any additional information or documentation.

/* advertisement */
look ma, no stupid 20 line signature.