* (P:string:) glob qualifier-like effect for parameter expansion
@ 2014-09-14 20:42 Roman Neuhauser
2014-09-15 16:11 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Roman Neuhauser @ 2014-09-14 20:42 UTC (permalink / raw)
To: zsh-users
hello,
i was looking for a simple way to achieve *(P:--header:),
except my use case is parameter expansion, not globbing.
i've got something like::
fmt="\
From: %an <%ae>
Date: %aD
Subject: %s
"
set -A headers "${(@f):-"$(git show -s --format=$fmt $rev)"}"
and i'd like to add::
mime-construct "${(@???)headers}" ...
to get::
--header "From: ..." --header "Date: ..." --header "Subject: ..."
except it looks i'm "doomed" to a loop::
declare -a headers
for h; do
headers+=(--header $h)
done < <(git show -s --format=$fmt $rev)
mime-construct "${(@)headers}" ...
--
roman
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: (P:string:) glob qualifier-like effect for parameter expansion
2014-09-14 20:42 (P:string:) glob qualifier-like effect for parameter expansion Roman Neuhauser
@ 2014-09-15 16:11 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2014-09-15 16:11 UTC (permalink / raw)
To: zsh-users
On Sep 14, 10:42pm, Roman Neuhauser wrote:
}
} set -A headers "${(@f):-"$(git show -s --format=$fmt $rev)"}"
}
} and i'd like to add::
}
} mime-construct "${(@???)headers}" ...
}
} to get::
}
} --header "From: ..." --header "Date: ..." --header "Subject: ..."
You can do this in zsh 5.0.6:
torch% x=(--header)
torch% y=(From Date Subject)
torch% print -R ${x:^^y}
--header From --header Date --header Subject
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-15 16:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-14 20:42 (P:string:) glob qualifier-like effect for parameter expansion Roman Neuhauser
2014-09-15 16:11 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).