Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: Re: Web-Safe Color Chart

by trantor (Chaplain)
on Oct 05, 2001 at 14:56 UTC ( #116959=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Web-Safe Color Chart
in thread Web-Safe Color Chart

Yes, this is somewhat unexpected for most people, but it turns out that shells (bash and tcsh at least) always expand a list enclosed in curly braces regardless of the presence of actual files.

It is called Brace Expansion and it differs from Pathname Expansion in that file names need not exist (quoted from the bash manpage).

You can verify easily with:

$ ls {a,b,c} ls: a: No such file or directory ls: b: No such file or directory ls: c: No such file or directory $ ls [abc] ls: No match. $

The fact that files do not have to exist is to be regarded as a feature, not as a bug, because you can say at the shell prompt something like (by the way, you can nest):

$ mkdir -p {1999,2000,2001}/backup/{0{1,2,3,4,5,6,7,8,9},11,12}

And get 36 directories created with one command.

-- TMTOWTDI

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116959]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2023-12-10 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (39 votes). Check out past polls.

    Notices?