From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10771 invoked by alias); 7 Nov 2015 09:32:53 -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: 20911 Received: (qmail 16997 invoked from network); 7 Nov 2015 09:32:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=c/TbxOtLfKuXLwQ3UllhL0lO95G3XMiaYVJvvE1qG7Q=; b=xOb+9ArhFD7dQKMIpi2GYidJWrxqucyI5z/UhS8+WZep7yiJTlN5lqMV3+FRlq/5AZ wMFEtiUaCu5cJSUEL5P+sWZC18vOGK+ODP76KW51GrRB8W6Utjc5IAZpATs6U807ApZw 38lodbrP8L1R0CjCU7HZmnLagbXfOuD4NWOtBkvEqWJl2j6NoKOCPI7/+oB/Q3zyBAP0 Uh9Fp8tG2GjQcp6wbyZNWEoC/UQDX6/l9FbZV4roxsjJWKqFlbvaqmdXXtLZKT2T98YO 1ZyhCyVZfZ16mJZOrrQRde3pFNFDQ51dsvrdq6fw36lrvIuvsNOBaIhv58Un7QqCw1T2 xzGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=c/TbxOtLfKuXLwQ3UllhL0lO95G3XMiaYVJvvE1qG7Q=; b=I8oDJO5SiWk3agHuZsaTBYa7E62s+Pf+0vk9Z9wuq90EUv3l8N7V3cZNxyE8/4Ai3b /p0iQ3Jiii0qE5l7nCrm6UEGhzrtSGGqwuNKvO9eF6hrr8ldYiZLRsqcpaffDr4cUgP5 S9jy4amX/LXpimdwpXLk0J0tgUU+zl3EXPx8vgz/Ts7kQedar1s7Md0yWrJXWRd37VFW L903nSSIXBeK3r3oVdzQw2kfujWgYmD33iEU+hcwg850Jc6+1dlZGM0BySlF5RBT/jNZ 30N3bGb1XnoRzM4wuICBXO8Q4T2SRQ3fotpTh05vE7HwGkBZjGJzMTYYpNMbp1g+WicQ L2WQ== X-Gm-Message-State: ALoCoQm1kHsYz0Cx6l3KBnnoKXERqMyRVr4oNFDVDNS4tAk0RK+ttCVCI6VCKokngUH01ZUugiiX X-Received: by 10.182.236.101 with SMTP id ut5mr11030367obc.73.1446888766980; Sat, 07 Nov 2015 01:32:46 -0800 (PST) From: Bart Schaefer Message-Id: <151107013244.ZM23334@torch.brasslantern.com> Date: Sat, 7 Nov 2015 01:32:44 -0800 In-Reply-To: <563D9B54.9010604@eastlink.ca> Comments: In reply to Ray Andrews "Re: convolutions" (Nov 6, 10:33pm) References: <563D5ED5.1070102@eastlink.ca> <563D9B54.9010604@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: convolutions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 6, 10:33pm, Ray Andrews wrote: } Subject: Re: convolutions } } I did indeed edit it a bit. Here's the pasted actual test file: } } test2 () } { } echo "$(eval echo "\${$(cat junk1)}")" >! junk2 } cat junk2 } } } } ... which works as advertised. That will fail with "bad substitution" for anything more than a single word in the file "junk1". torch% echo "this is some text" > junk1 torch% test2 () { echo "$(eval echo "\${$(cat junk1)}")" >! junk2 cat junk2 } torch% test2 (eval):1: bad substitution torch% You can't just throw ${ } around any arbitrary thing and have it act like a parameter expansion -- which is what is happening during the eval when you have used \$ in the original expression: torch% setopt xtrace verbose torch% test2 test2 +Src/zsh:25> test2 +test2:2> cat junk1 +test2:2> eval echo '${this is some text}' (eval):1: bad substitution +test2:2> echo '' +test2:3> cat junk2 torch% -- and you don't even need it there in this case: torch% test2 () { echo "$(eval echo "$(cat junk1)")" >! junk2 cat junk2 } torch% some=OTHER torch% echo 'this is $some text' >| junk1 torch% test2 this is OTHER text torch% } > print -R "${(e)$(| out_file } } Does the trick, thanks, it's no shorter, but much more respectable. } print has many tricks up it's sleeve. Sigh. No, "-R" is explicitly telling "print" not to do any tricks at all. It's the (e) parameter expansion flag that's doing the work.