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

Re: UNIX challenge of the day

  • Subject: Re: UNIX challenge of the day
  • From: Roy Schestowitz <newsgroups@xxxxxxxxxxxxxxx>
  • Date: Sun, 18 Sep 2005 13:04:56 +0100
  • Newsgroups: alt.www.webmaster
  • Organization: schestowitz.com / MCC / Manchester University
  • References: <bv4tv2-6rs.ln1@ophelia.g5n.co.uk> <kcguv2-04s.ln1@ophelia.g5n.co.uk> <Pine.GSO.3.95.iB1.0.1050918073647.24664I-100000@halifax.chebucto.ns.ca>
  • Reply-to: newsgroups@xxxxxxxxxxxxxxx
  • User-agent: KNode/0.7.2
__/ [Norman L. DeForest] on Sunday 18 September 2005 11:38 \__

> On Sat, 17 Sep 2005, Toby Inkster wrote:
> 
>> Toby Inkster wrote:
>> 
>> > # cat ~tai/jukebox-2.19b.pl >/usr/bin/jukebox.pl
>> > # cp ~tai/jukebox-2.19b.pl /usr/bin/jukebox.pl
>> 
>> First one: /usr/bin/jukebox.pl keeps its existing permissions; second
>> one: it takes its permissions from ~tai/jukebox-2.19b.pl. So the first
>> one saves me having to chown and chmod.
> 
> OK, my wild guess (written before I read this post since I have Pine sort
> by subject) was wrong.


Well, I thought it was a cunning suggestion nonetheless. I could not ever
imagine that a directory with .pl or even a dot in it would exist by
default, i.e. without intervenation from an eccentric user.

Toby, the big question is: did you /intentionally/ choose one over the
other, or was your riddle a side-effect? Answer only if you can be arsed.


[Norman L. DeForest] on Sunday 18 September 2005 11:25:

> A wild guess:
> 
> If the system had a directory named "jukebox.pl" in the /user/bin
> directory, then I suspect that this:
> 
> # cat ~tai/jukebox-2.19b.pl >/usr/bin/jukebox.pl
> 
> would fail (I don't think you can redirect STDOUT to a directory but
> don't have a Unix/Linux box to check this) while this:
> 
> # cp ~tai/jukebox-2.19b.pl /usr/bin/jukebox.pl
> 
> would end up creating a file, /usr/bin/jukebox.pl/jukebox-2.19b.pl
> since the target of the cp command can be a filename or a directory name.
> 
> So If you really wanted a copy of ~tai/jukebox-2.19b.pl to end up being
> /usr/bin/jukebox.pl then the cat command would do what you intend or
> give you an error message if it's not possible while the cp command
> could end up doing something else with no error message at all.
> 
> Norman "also wondering what would happen if /usr/bin/jukebox.pl
> was a symbolic link or was pointed to by a symbolic
> link before a cat or cp command was issued" De Forest

Roy

-- 
Roy S. Schestowitz      | Prevalence does not imply ideali$M
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  1:00pm  up 24 days  1:14,  3 users,  load average: 0.49, 0.64, 1.07

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