Link to home
Start Free TrialLog in
Avatar of thomaswright
thomaswright

asked on

How to enter alt key codes in a Linux BASH shell

I'm using ssh in a rsync script.  I'm trying to transfer files from a folder name which has spaces in the name:

rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:/datafiles/folder name with space/*"

SSH is having trouble understanding the spaces.  I want to use an alt-key-combination such as  ALT-0255 on the keypad to enter a space, but I can't quite figure out how to do that in the BASH shell in linux.

Avatar of hernst42
hernst42
Flag of Germany image

try correct quoting like:
rsync -avz -e "ssh -i local-rsync-key"  /<mybackupdir> "backup@<remoteIP>:/datafiles/folder name with space/*"
then it should work also with spaces
Avatar of omarfarid
You may use single quotes around the folder name
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thomaswright
thomaswright

ASKER

You got me on the right track. Thanks!
The proper syntax for the solution is

sync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:'/datafiles/folder name with space/'*"

Note: Notice the single quotes surrounding the entire path.
Correction!: I forget a double quote before @backup:

This works:

sync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/datafiles/folder name with space/'*"
I also forgot the destination path, so its:

rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/datafiles/folder name with space/'*" /<destinationpath>/