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). HTH, --Stijn -- 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.
msg19011/pgp00000.pgp
Description: PGP signature