From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11097 invoked by alias); 10 Nov 2016 16:13:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22109 Received: (qmail 8881 invoked from network); 10 Nov 2016 16:13:15 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(0.0/5.0):. Processed in 0.387788 secs); 10 Nov 2016 16:13:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=PTn+HCQOPg8LiHzpzn3ja66CrpI=; b=moKPZh3Qq5zVNGDhShkZp HO6Jhki5LokKW3mUeuR43pp71AQxF4HtRUEdL44kYwvyPx2/daq2C8hepd51KyoZ Gj4HSxSyHazz9/VNt0DENFLdrvLC9BtP963VUpDtvTohGuyisvRj0ZWEcxW/R8So pQpkQ+mONCeB2e3hqlIFvY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=PTn+HCQOPg8LiHzpzn3ja66CrpI=; b=L+T6rrTjvsmgfMebghVH LmDSzcMDsxk5cpmsl1bCDILlEFD5qRIHhlmpw02dwoF3q2V1J0VU1ePcR80h6SHv IX9fi3/WACF0ytVdP1nTolVSEoHomFevGFShnPCkqrY1VwVTyAL5rl64gYV2SwsJ dDrbOiA9PMaqkLD1RCll8n4= X-ME-Sender: X-Sasl-enc: LKcDMBcCSrka0u5vsJkVazqAPaxaPpQefCJQF3a9O3O0 1478794388 Date: Thu, 10 Nov 2016 16:10:49 +0000 From: Daniel Shahaf To: Bernd Steinhauser Cc: zsh-users@zsh.org Subject: Re: Mapping quoted parameter in function Message-ID: <20161110161049.GA27095@fujitsu.shahaf.local2> References: <0a521f25-d548-d3b1-fb2e-7559f7995b7d__49592.623851686$1478759489$gmane$org@bernd-steinhauser.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0a521f25-d548-d3b1-fb2e-7559f7995b7d__49592.623851686$1478759489$gmane$org@bernd-steinhauser.de> User-Agent: Mutt/1.5.23 (2014-03-12) Bernd Steinhauser wrote on Thu, Nov 10, 2016 at 07:20:17 +0100: > progfunc() { > CORES=12 > program -n ${CORES} "foo='bar'" foo2="1 $3" > } > > What I would want to do is to ensure that if I call > `progfunc x` > > this would translate into "foo='x'", without touching the rest of the call. > Is that somehow possible? If you want to get «x» as your $1 argument and have the callee see «foo='x'» as its argument, you can do this: progfunc() { program "foo='$1'" } Or this: progfunc() { program "foo=${(q)1}" } If that doesn't answer your question, then please clarify it. > iirc, variables won't work, because of the quoting style? «"foo'$bar"» does interpolate $bar as a variable, despite the single quote in there, because the ' is literal (part of the string data). «"foo"'$bar'» doesn't, because the ' is syntactical. Cheers, Daniel > Best Regards, > Bernd >