Unix already has "attributes"...

Ken Arnold%CGL arnold at ucsfcgl.UUCP
Fri Aug 23 15:58:23 AEST 1985


In article <2636 at sun.uucp> gnu at sun.uucp (John Gilmore) writes:
>Why do you have to copy
>executables with "cp" rather than "cat" or "dd"?  They won't execute if
>you cat them...because the file permissions are specifically propagated
>by code in "cp", but not by "cat".

To copy files with cp you say "cp file1 file2".  To copy files with cat
you say "cat file1 > file2".  If you look carefully, you will note that
cat does not copy files.  That is not its function.  The ">" part of
the command is executed by the shell, which is simply putting the
output of whatever command is to the left of the ">" into the file
named on the right.  It doesn't know that you're trying to do a copy.
What permissions should be set "make.out" given
	make >& make.out
?  Does it need execute permissions?  You're asking for dwim, here.

"cp" is to copy files.  "cat" is to concatentate them and print them.
That there are many ways to do almost anything in UNIX, but this does
not relieve you of the responsibility of using wrong ones.  "dd", of
course, does claim to copy files, but it was really designed for moving
files to and from devices, not just copying one file to another, so you
might look somewhat kindly on the people who left it out.

		Ken Arnold



More information about the Comp.unix.wizards mailing list