[GRLUG] Paths
Michael Mol
mikemol at gmail.com
Sat Sep 20 18:10:40 EDT 2008
On Sat, Sep 20, 2008 at 5:43 PM, Ben DeMott <ben.demott at gmail.com> wrote:
> I feel like a noob asking this, and probably will be chastized for asking,
If you ever act so incredibly deferential on this list again, I will
personally electronically chastise you for doing so. :-P
No question deserves an insult for an answer; If you get one, read
around it and carry on. This isn't USENET. :-)
>
> I was coding away today ... and I realized (not sure why I never noticed
> before) that python seemed to think //etc//httpd//conf.d was a perfectly
> legitimate directory name.
>
> I then opened my terminal (bash) and was surprised to find that typing `cd
> //etc//httpd//conf.d` worked just fine.
>
> Is this a feature - or am I missing the point about something - and secondly
> would it be wise to allow this behaviour in my program for when an
> individual specifies a path?
It's common behavior on Linux; Having to path delimiters (//) gets
collapsed, though I'm not sure where it happens. In any case, if it's
a behavior that's everywhere and that people may depend on, it would
break the user's expectations for you to disallow it in your own code.
An example where it's useful: If you have a shell variable $VAR that's
a path to a directory, and you want to put something in that
directory, you can simply say $VAR/filename. If $VAR already has a
trailing /, the additional one gets collapsed into it.
--
:wq
More information about the grlug
mailing list