On Fri, 2003-06-13 at 01:22, [EMAIL PROTECTED] wrote:
> Hi everyone,
> 
>       I am writing some shell scripts, but I run into some problems.
> I have a dir name which has space in it.  I know this is bad but I can't
> avoid it.  I am forced to deal with this situation.  How do I set a
> variable that contain the dir name which has space in it.  I tried
> several ways:
> 
> $PDB=~/.kde/share/apps/kpilot/DBBackup/Cool Joe/AddressDB.pdb
> $PDB="~/.kde/share/apps/kpilot/DBBackup/Cool Joe/AddressDB.pdb"
> $PDB='~/.kde/share/apps/kpilot/DBBackup/Cool Joe/AddressDB.pdb'
> 
> ls $PDB
> 
> give me error.  is there a way or no way?
> 
> -- 
> Edwin ERTW Lau
[EMAIL PROTECTED]:~# mkdir a space
[EMAIL PROTECTED]:~# ls -ld a space
drwxr-xr-x    2 root     root         4096 2003-06-13 01:50 a
drwxr-xr-x    2 root     root         4096 2003-06-13 01:50 space
[EMAIL PROTECTED]:~# rmdir a space
[EMAIL PROTECTED]:~# ls -ld a space
ls: a: No such file or directory
ls: space: No such file or directory
[EMAIL PROTECTED]:~# mkdir "a space"
[EMAIL PROTECTED]:~# ls -ld a space
ls: a: No such file or directory
ls: space: No such file or directory
[EMAIL PROTECTED]:~# ls -ld "a space"
drwxr-xr-x    2 root     root         4096 2003-06-13 01:50 a space
[EMAIL PROTECTED]:~# X=a space
bash: space: command not found
[EMAIL PROTECTED]:~# echo $X

[EMAIL PROTECTED]:~# X="a space"
[EMAIL PROTECTED]:~# echo $X
a space
[EMAIL PROTECTED]:~# echo "$X"
a space
[EMAIL PROTECTED]:~# ls -ld $x
drwxr-xr-x   77 root     root         4096 2003-06-13 01:50 .
[EMAIL PROTECTED]:~# ls -ld $X
ls: a: No such file or directory
ls: space: No such file or directory
[EMAIL PROTECTED]:~# ls -ld "$X"
drwxr-xr-x    2 root     root         4096 2003-06-13 01:50 a space
[EMAIL PROTECTED]:~# exit
-- 
Kevin Mark <[EMAIL PROTECTED]>

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to