From owner-freebsd-questions Wed Feb 12 4: 5:53 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA7A737B401 for ; Wed, 12 Feb 2003 04:05:51 -0800 (PST) Received: from pcwin002.win.tue.nl (pcwin002.win.tue.nl [131.155.71.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id A66D043F75 for ; Wed, 12 Feb 2003 04:05:50 -0800 (PST) (envelope-from stijn@pcwin002.win.tue.nl) Received: from pcwin002.win.tue.nl (orb_rules@localhost [127.0.0.1]) by pcwin002.win.tue.nl (8.12.6/8.12.6) with ESMTP id h1CC6HVw091352; Wed, 12 Feb 2003 13:06:17 +0100 (CET) (envelope-from stijn@pcwin002.win.tue.nl) Received: (from stijn@localhost) by pcwin002.win.tue.nl (8.12.6/8.12.6/Submit) id h1CC6Hc6091351; Wed, 12 Feb 2003 13:06:17 +0100 (CET) Date: Wed, 12 Feb 2003 13:06:17 +0100 From: Stijn Hoop To: "Denis N. Peplin" Cc: freebsd-questions@freebsd.org Subject: Re: can't peform blankspace escape - sh command substitution bug or feature? Message-ID: <20030212120617.GD3141@pcwin002.win.tue.nl> References: <200302121506.29923.info@volginfo.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dFWYt1i2NyOo1oI9" Content-Disposition: inline In-Reply-To: <200302121506.29923.info@volginfo.ru> User-Agent: Mutt/1.4i X-Bright-Idea: Let's abolish HTML mail! Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --dFWYt1i2NyOo1oI9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 12, 2003 at 03:06:29PM +0300, Denis N. Peplin wrote: > I try to escape blankspace in filenames by using backslash > First, i'm test sed expression: > $ sed 's/ /\\ /g' > long file name > long\ file\ name >=20 > this ok. >=20 > second, include this sed expression in sh command substitution: > $ filename=3D`echo "long file name" | sed 's/ /\\ /g'` ; echo $filename > long file name >=20 > with csh all ok, but with Bourne not. is this bug or feature? > i'm searched in google and only found different instructions about > escaping variables by hand... Escaping inside backticks ` is very tricky. Try this instead: $ filename=3D$(echo "long file name" | sed 's/ /\\ /g'); echo $filename long\ file\ name In /bin/sh, $() is the same construct as ``, see man sh(1). HTH, --Stijn --=20 The right half of the brain controls the left half of the body. This means that only left handed people are in their right mind. --dFWYt1i2NyOo1oI9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+Sji5Y3r/tLQmfWcRAl4cAJsHy5Wk/S0lCNflQlWO6tgz1lZyzQCfRSBC o2dMM/RfCbhOAe1GX96uXj8= =dN6S -----END PGP SIGNATURE----- --dFWYt1i2NyOo1oI9-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message