From: Nikolai Weibull <lone-star@home.se>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Substitution Cruft
Date: Wed, 10 Sep 2003 15:21:29 +0200 [thread overview]
Message-ID: <20030910132129.GE3743@puritan.pcp.ath.cx> (raw)
OK. This has been annoying me for some time. I must be doing something
wrong, or there must be an easier way in any case. I want to run a
command with command line options output from a shell substitution:
lprec ${(Q)${(zf)$(sed -n 's/["\$]/\\&/g;s/^\([A-Za-z]\+\)=\(.\+\)$/--\L\1\E "\2"/;/^--[a-z-]\+/p' < $tmp)}} &
what this does is read a file ($tmp) that looks like
Option1: value1
Option2: value2
and turns this into
--option1 "value1"
--option2 "value2"
and this is then passed to the command 'lprec'.
Is there a simpler way than using ${(Q)${(zf)...}}?
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,php,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
next reply other threads:[~2003-09-10 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-10 13:21 Nikolai Weibull [this message]
2003-09-10 14:31 ` Bart Schaefer
2003-09-10 16:54 ` Nikolai Weibull
2003-09-10 13:57 Borzenkov Andrey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030910132129.GE3743@puritan.pcp.ath.cx \
--to=lone-star@home.se \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).