On Fri, 2003-06-13 at 01:22, try_email_me@yahoo.ca 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 root@linux:~# mkdir a space root@linux:~# 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 root@linux:~# rmdir a space root@linux:~# ls -ld a space ls: a: No such file or directory ls: space: No such file or directory root@linux:~# mkdir "a space" root@linux:~# ls -ld a space ls: a: No such file or directory ls: space: No such file or directory root@linux:~# ls -ld "a space" drwxr-xr-x 2 root root 4096 2003-06-13 01:50 a space root@linux:~# X=a space bash: space: command not found root@linux:~# echo $X root@linux:~# X="a space" root@linux:~# echo $X a space root@linux:~# echo "$X" a space root@linux:~# ls -ld $x drwxr-xr-x 77 root root 4096 2003-06-13 01:50 . root@linux:~# ls -ld $X ls: a: No such file or directory ls: space: No such file or directory root@linux:~# ls -ld "$X" drwxr-xr-x 2 root root 4096 2003-06-13 01:50 a space root@linux:~# exit -- Kevin Mark <kmark@pipeline.com>
Attachment:
signature.asc
Description: This is a digitally signed message part