BASH Programming: spaces ignored

sean_at_mail.capitalgenomix.com
Date: 05/30/05


Date: Mon, 30 May 2005 14:45:25 GMT

I'm having difficulty with a BASH script that I'm attempting to write.
I'm attempting to change directories to a path with a space in the name
and it appears that the spaces are being dropped. Following is the
script:

#!/bin/bash
fileserver_path="/mnt/fs/Documents/DS\ -\ Datasheets/"

cd $fileserver_path

if [ "$?" != "0" ]; then
  echo Cannot locate $fileserver_path
  exit 1
fi

The following error occurs with this script:

./script: line 4: cd: /mnt/fs/Documents/DS\: No such file or directory

As you can see, the spaces are being ignored. I've tried everything I
could think of to get it to stop ignoring the spaces; however, I've been
quite unsuccessful.

Can anybody please give me some advise? I'm quite new to BASH
programming so it's quite possible that I'm going about this the wrong
way. If I am, feel free to provide any advise.

Thank you advance,

-- 
Sean

Quantcast