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

Re: A minor syntax question



Jesper Nygårds wrote:
>     typearg="("${"$(print -- '-o -type '${^types:#-t})"#-o }")"

> away the leading '-o'. It works as intended, but I feel it is more
> complicated than required. In particular, I couldn't find a way to make the
> '${^...}' parameter expansion trigger without the embedded print statement.

Joining the array to form a string should avoid the need for a print,
allowing the #-o to apply to the string as a whole. E.g:

typearg=${${(j. .):-'-o -type '${^types:#-t}}#-o }

Shorter versions should be possible such as the following:

typearg="${${=types//-t/-o -type}[2,-1]}"

I'd be inclined to keep typearg as an array, however.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author