bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: give me some syntax sugar, honey!


From: Stig Zax Hackvän
Subject: Re: give me some syntax sugar, honey!
Date: Fri, 9 Nov 2001 16:04:31 -0800
User-agent: Mutt/1.2.5i

On Fri, Nov 09, 2001 at 12:23:11PM -0500, Paul Jarc wrote:
> address@hidden wrote:
> >     foo[12-21]  would expand to foo12, foo13, ... foo20, foo21
> 
> The [] syntax already has meaning, so it shouldn't be changed.  It

[N-M] has meaning, but [NN-MM] does not.  my suggestion for appropriate
treatment of [NN-MM] is an intuitive extension of the the existing behavior.
If you know that foo[0-5] specifies six files numbered 0 through 5, then
foo[12-21] does what you would expect by specifying a range of files.

similarly, [12-17,19-21,33] is an intuitive shorthand for {[12-17],[19-21],33}

> could be done with a different syntax, but maybe this will already
> work for you:
> eval "echo foo{$(seq -s, 12 21)}"
> Beware that this will produce all such filenames, regardless of
> whether those files exist.

that's a clever shell hack, but it's no good for typing on a regular basis.

this observation is particularly astute and is the essence of what i'm getting 
at:

    Perl is a language for getting your job done.
    
    Of course, if your job is programming, you can get your job done with any
    "complete" computer language, theoretically speaking.  But we know from
    experience that computer languages differ not so much in what they make
    POSSIBLE, but in what they make EASY.
    
    - Programming Perl (p ix), Larry Wall, Tom Christiansen, Randal Schwartz

my hope is/was to make this sort of interaction with the shell more expressive.

big incantations to do conceptually simple things aren't fun to type and it
makes sense to have a simpler way to express a numeric-sequence of files
concisely.

        stig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]