[Top][All Lists]

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

Re: Bash and cd

From: Roman Rakus
Subject: Re: Bash and cd
Date: Mon, 12 Apr 2010 16:15:32 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100330 Fedora/3.0.4-1.fc11 Lightning/1.0b2pre Thunderbird/3.0.4

On 04/11/2010 08:56 PM, Rue U wrote:
The "cd" command/program doesnt work with paths stored in a variable.

If the variable contains the backslash.

Such as:

var=/media/New\ Folder\ Here/
cd $var
bash: cd: /tmp/New: No such file or directory
/tmp/etc... ? Shouldn't be /media/etc...?
echo $var
/tmp/New Folder Here/

OKAY FAIR ENOUGH. NOT ESCAPED. Now let me add some escapes!

var="/tmp/New\ Folder\ Here/"

cd $var
bash: cd: /tmp/New\: No such file or directory

It stops right at the first escape.

Is there a solution to this? Thanks

Try `cd "$var"'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]