Unix Shell - Set variable to directory name with space

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > April 2005 > Set variable to directory name with space





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Set variable to directory name with space
loic_e_bertrand@yahoo.fr

2005-04-20, 7:48 am

Hi,

I have a very simple question regarding the use of tsch set with a
space in the directory name.

I tried:
> set ACTIVE=3D"/Library/Application\ Support/Palm\ HotSync/Conduits/"
> cd $ACTIVE


This fails with the error:
tcsh: cd: Too many arguments.

What is the right command?

Best regards,

Lo=EFc

Bruce Barnett

2005-04-22, 8:47 pm

loic_e_bertrand@yahoo.fr writes:

>
> This fails with the error:
> tcsh: cd: Too many arguments.
>
> What is the right command?


either
cd "$ACTIVE" # portable for all shells
or
cd $ACTIVE:q # a csh/tcsh "feature"




--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.
Ed Morton

2005-04-22, 8:47 pm



Kenny McCormack wrote:

> In article <1113828021.066624.16640@z14g2000cwz.googlegroups.com>,
> <loic_e_bertrand@yahoo.fr> wrote:
>
>
>
> cd "$ACTIVE"


And you probably don't need to escape the spaces when you init the
variable (you certainly don't in bourne-like shells):

set ACTIVE="/Library/Application Support/Palm HotSync/Conduits/"
cd "$ACTIVE"

Regards,

Ed.
Bruce Barnett

2005-04-25, 7:55 am

loic_e_bertrand@yahoo.fr writes:

>
> This fails with the error:
> tcsh: cd: Too many arguments.
>
> What is the right command?


either
cd "$ACTIVE" # portable for all shells
or
cd $ACTIVE:q # a csh/tcsh "feature"




--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com