Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Glob specifiers for intermediate path components



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