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>:/datafil es/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.
rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:/datafil
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.
You may use single quotes around the folder name
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You got me on the right track. Thanks!
ASKER
The proper syntax for the solution is
sync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:'/datafi les/folder name with space/'*"
Note: Notice the single quotes surrounding the entire path.
sync -avz -e "ssh -i local-rsync-key /<mybackupdir> backup@<remoteIP>:'/datafi
Note: Notice the single quotes surrounding the entire path.
ASKER
Correction!: I forget a double quote before @backup:
This works:
sync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/dataf iles/folde r name with space/'*"
This works:
sync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/dataf
ASKER
I also forgot the destination path, so its:
rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/dataf iles/folde r name with space/'*" /<destinationpath>/
rsync -avz -e "ssh -i local-rsync-key /<mybackupdir> "backup@<remoteIP>:'/dataf
rsync -avz -e "ssh -i local-rsync-key" /<mybackupdir> "backup@<remoteIP>:/datafi
then it should work also with spaces