Re: Problem with spaces in filenames



On Sun, 2004-05-16 at 22:03 +1000, Peter Harvey wrote:
> A possibly better piece of shell script is this:
> 
> FILE=$(echo -e "$(echo ${NAUTILUS_I_FORGET_THE_NAME_OF_THE_VAR} | sed -e 's/^file:\/\///' -e 's/\\/\\\\/g' -e 's/%/\\x/g')")

Personally, I use:

(where $URL is the name of the var we can't remember the name of, this
is from a nautilus thumbnailer which accepts $1 as the URL)

PROTOCOL=${URL%%//*}
if [ "x$PROTOCOL" != "xfile:" ] ; then
	echo "URL is not local" >&2
        exit 1
fi
INPUT=${URL##*://}

Ross




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]