Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Glob specifiers for intermediate path components
- X-seq: zsh-users 19452
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Glob specifiers for intermediate path components
- Date: Wed, 26 Nov 2014 17:52:40 -0800
- In-reply-to: <CAHYJk3TOZpJKUDxczqkr2RYJbOkjjN4mqG=kcf9o=3j=843QEA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAO8h=njW+7we5z+_E8pCYKdCG3UGUqWEJAZpsaQTts25ENpOyw@mail.gmail.com> <CAHYJk3TOZpJKUDxczqkr2RYJbOkjjN4mqG=kcf9o=3j=843QEA@mail.gmail.com>
On Nov 26, 7:00pm, Mikael Magnusson wrote:
}
} > More generally, how can I specify glob qualifiers for intermediate
} > path components? In spirit:
} >
} > $ print -l a(...)/b(...)/c(...)/d(...)/e(...)/f(...)
}
} You can't, as such. There are at least two workarounds I can think of.
A third would be something like this:
glueglob() {
emulate -R zsh -o csh_null_glob
local here there
while (( ARGC ))
do
here=( $^here$~1 )
here=( ${^here}${2:+/} )
shift
done
print $here
}
print -l $( noglob glueglob a(...) b(...) c(...) d(...) e(...) f(...) )
There's almost certainly a fancy expression that could be written to
split a(...)/b(...)/c(...)/d(...)/e(...)/f(...) on the slashes without
being confused by the (/) glob qualifier, but I'm not going to attempt
to write it tonight.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author