Date: Wed, 12 Feb 2003 15:27:14 +0300 From: "Denis N. Peplin" <info@volginfo.ru> To: freebsd-questions@freebsd.org Subject: Re: can't peform blankspace escape - sh command substitution bug or feature? Message-ID: <200302121518.11094.info@volginfo.ru> In-Reply-To: <20030212120617.GD3141@pcwin002.win.tue.nl> References: <200302121506.29923.info@volginfo.ru> <20030212120617.GD3141@pcwin002.win.tue.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302121518.11094.info>