cd to a directory with a blank in its name

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
t001mj
Posts: 2
Joined: Wed Jun 19, 2013 10:48 pm

cd to a directory with a blank in its name

Post by t001mj »

Hi,
We've come upon a problem wherein to put a file on a remote server, we must issue a cd from the default home directory to a subdirectory with a blank in its name. For example, the home directory would be /root/level1/level2 and we need to cd to a subdirectory with the name "BL ANK" (without the quotes). Is there a way to do this?
Thanks in advance for any advice.
Mike
coz
Posts: 392
Joined: Fri Jul 30, 2004 5:29 pm

Re: cd to a directory with a blank in its name

Post by coz »

You can enclose the argument to cd in double quotes:

Code: Select all

cd "BL ANK"
or

Code: Select all

cd "/home/user/my dir with spaces"
t001mj
Posts: 2
Joined: Wed Jun 19, 2013 10:48 pm

Re: cd to a directory with a blank in its name

Post by t001mj »

Thanks for the quick reply. That works, but what my user wants to do in batch is send from an MVS dataset to this directory with the blanks in it. If I put the double-quotes in the rfile statement, it doesn't take it when I call sftp_put.sh. I can connect using sftp_connect.sh, but can I send an MVS dataset from within that script?

Thanks again.
coz
Posts: 392
Joined: Fri Jul 30, 2004 5:29 pm

Re: cd to a directory with a blank in its name

Post by coz »

If you don't need to do any interpolation, you can enclose the argument in single quotes:

Code: Select all

rfile='"/home/user/dir with spaces/"'
If you need to interpolate, you can escape the inner quotes:

Code: Select all

rfile="\"/home/user/${some_zos_sh_var}/dir with spaces/\""
Post Reply