Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: UNIX cat and cp

__/ [Steve Sobol] on Saturday 17 September 2005 15:55 \__

> Roy Schestowitz wrote:
>> __/ [Toby Inkster] on Saturday 17 September 2005 10:41 \__
>> 
>> 
>>>Why did I just run this command (as root):
>>>
>>># cat ~tai/jukebox-2.19b.pl >/usr/bin/jukebox.pl
>>>
>>>instead of this one:
>>>
>>># cp ~tai/jukebox-2.19b.pl /usr/bin/jukebox.pl
>>>
>>>?
>>>
>>>I promise you, there is a good reason. :-)
>> 
>> 
>> Because it looks more original?
>> 
>> Now truly, it seems like it would achieve the same,
> 
> No it wouldn't.
> 
> The first commandline pipes the output of cp to jukebox.pl and there *is*
> no output from the cp command - so it would create an empty file. The
> second commandline actually copies the file.

I have just done a little test, but I still fail to see why it would create
an empty file. It doesn't. The number of arguments in cat is unconstrained.
In fact, for the past month I have been concatenating dozens of files per
day using 'cat'.

You also said "The first commandline pipes the output of cp...". There is no
cp in the first commandline though, not explicitly anyway. Am I missing
something (aparts from the wits of course)?

Roy

-- 
Roy S. Schestowitz      | "Pentiums melt in your PC, not in your hand"
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  4:10pm  up 23 days  4:24,  2 users,  load average: 0.13, 0.41, 0.41

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index