Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Substitution Cruft
- X-seq: zsh-users 6558
- From: Nikolai Weibull <lone-star@xxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Substitution Cruft
- Date: Wed, 10 Sep 2003 15:21:29 +0200
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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);}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author