From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13169 invoked from network); 28 Sep 2022 10:02:45 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Sep 2022 10:02:45 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1664359365; b=S2DWGFvdzn3aCmBAalW44KMY+9zTum01Vb5LbtjKCFM9+kF071mfpGGaKh9s0y99SPZ9ue5n0O ZCtn82s9rqsF4i4pzytCM4VQZ6Azvpwvw7NxLWba1YiYqDDthIxvUD9AJdTmjFSGb+8f7J0JhT 9lwscDBqYsyT8DIV70cu1XqFneUZve3+4WmevX0JOfClgrNJddKHZ0W0WyhDXLEXZCuBUP4jNZ JYrTn3XVPipV6ECwtg+xTybjkD8e1WDniA2lzFkcTZde94uW8EPPsEwbtpSdE9UgZK8nEEt6x1 ldJ2nEEaXyPx1MLhWMB1ltKko0Wr1LUBRNB/OkBTjzO+pA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay6-d.mail.gandi.net) smtp.remote-ip=217.70.183.198; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1664359365; bh=rznfaYdi5GKV9cSpaMwN0y6yduGOQV0agjFtEP+B3DA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature; b=l2HsAB9JNiPdnZNkoQOkI3Wy+48P+1ex5R40+ST3qFpFV4mH88MyI3MIBGWNuYutIKsmGVPdmK XAqBctmu+ViSU1i/GSqfmx4rCNMX3oPyD6J4f+yWuQTZmtr+cQ3fam28JA/Yc8Rw0gTk6JPauP Wy6DLmenUQWZko/aEaFTCWsFbd/2e+tFpmMcKNkE++IiuX+OoxMcuMGZcZ5krgaOPS1U7SmUhm uZmHlgaOymy+uSKfpeGvygAFm4zo8F7pHWAVgxACPvNosKqmpMqbobIRXE4Pe1NPT114DXhoo3 9JIH1E1iKK9AW+woYOPDSJlXLo6WVQ/QT5y3UycmVx+Abg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=23vYfraKH0LUXtLq3+fmMRs/7x5T4GdMPVWBToGW1D4=; b=RCVAsWgmMNFe4vFqCvW8awXsVx 6RSBWPwXB0QZ3GGDKSzn8LYYgNjWRL9Sy9LEftENhKStuAnR3hpW11VhvAWYC5xoTmcsuBo2aqnoc 9ANyMWs6sicdiSRcKgKShAoZla8ZZLNiDqOjBSBCXcvLLWtLggTdO9vb03YrzVnDM6A2ixpX+tyKs uWqlWbShET7k6PbSUXOXdw12HzzsPVvBy+UAXOvKiL5HfCjm6VRi3zDt8P9PhAdZt6/PEcZ1IT7It GxMUy/jBwADA7QQ/fI012Cbxt0GKOJANtzO81UwfubqvjyK6zYSPBJoBY6+tFcg9j2GcBZBc6mOpz R5y4Ypew==; Received: from authenticated user by zero.zsh.org with local id 1odTts-0006Dt-Fm; Wed, 28 Sep 2022 10:02:44 +0000 Authentication-Results: zsh.org; iprev=pass (relay6-d.mail.gandi.net) smtp.remote-ip=217.70.183.198; dmarc=none header.from=chazelas.org; arc=none Received: from relay6-d.mail.gandi.net ([217.70.183.198]:41167) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1odTrc-0005QZ-02; Wed, 28 Sep 2022 10:00:24 +0000 Received: (Authenticated sender: stephane@chazelas.org) by mail.gandi.net (Postfix) with ESMTPSA id BFF5BC0010; Wed, 28 Sep 2022 10:00:21 +0000 (UTC) Date: Wed, 28 Sep 2022 11:00:20 +0100 From: Stephane Chazelas To: Ray Andrews Cc: Zsh Users Subject: Re: preserving single quotes Message-ID: <20220928100020.tn3debb7jkytyluz@chazelas.org> Mail-Followup-To: Ray Andrews , Zsh Users References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Seq: 28158 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: 2022-09-27 20:12:22 -0700, Ray Andrews: > I've done this before but I can't remember the invocation. > > $ dd="echo howdy" > > $ ee=$($=dd); echo $ee > howdy > > $ dd="aptitude search '?name(libreoffice-java-common)'" > > $ ee=$($=dd); echo $ee > > $ (no output) > > > ... I have to be able to run the aptitude command with the single quotes > intact.  I've tried every little trick that's worked before but I'm just not > finding the magic. Use either: dd() aptitude search '?name(libreoffice-java-common)' ee=$(dd) Or: dd="aptitude search '?name(libreoffice-java-common)'" ee=$(eval -- $dd) Or: dd=( aptitude search '?name(libreoffice-java-common)' ) # or dd=( aptitude search '?name(libreoffice-java-common)' ) # just to show that it's several arguments you want to store in # that array ee=$( "$dd[@]" ) $=dd just does $IFS-splitting. If $dd is meant to contain shell code, you should use eval to evaluate it. But to store code, you generally use functions not variables. The z and Q parameter expansion flags can do the same tokenisation and quote removal as the shell syntax parser does, but I don't think you want to go there. -- Stephane