From owner-freebsd-questions Wed Feb 12 4:21: 9 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 BD08037B401 for ; Wed, 12 Feb 2003 04:21:07 -0800 (PST) Received: from vsmi.ru (ns.vsmi.ru [217.23.84.98]) by mx1.FreeBSD.org (Postfix) with SMTP id 136AC43FB1 for ; Wed, 12 Feb 2003 04:21:06 -0800 (PST) (envelope-from info@volginfo.ru) Received: (qmail 92690 invoked from network); 12 Feb 2003 15:27:31 -0000 Received: from unknown (HELO img.local) (192.168.0.1) by 192.168.0.50 with SMTP; 12 Feb 2003 15:27:31 -0000 Content-Type: text/plain; charset="iso-8859-1" From: "Denis N. Peplin" To: freebsd-questions@freebsd.org Subject: Re: can't peform blankspace escape - sh command substitution bug or feature? Date: Wed, 12 Feb 2003 15:27:14 +0300 User-Agent: KMail/1.4.2 References: <200302121506.29923.info@volginfo.ru> <20030212120617.GD3141@pcwin002.win.tue.nl> In-Reply-To: <20030212120617.GD3141@pcwin002.win.tue.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200302121518.11094.info@volginfo.ru> 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 On Wednesday 12 February 2003 15:06, Stijn Hoop wrote: > 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 > > > > this ok. > > > > second, include this sed expression in sh command substitution: > > $ filename=`echo "long file name" | sed 's/ /\\ /g'` ; echo $filename > > long file name > > > > 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=$(echo "long file name" | sed 's/ /\\ /g'); echo $filename > long\ file\ name > > In /bin/sh, $() is the same construct as ``, see man sh(1). > Fine, Thank You :) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message