Escape Space in a ssh command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Escape Space in a ssh command
# 1  
Old 11-07-2009
Question Escape Space in a ssh command

The following statement does work. But the second command does not work as expected.

Code:
ssh root@123.123.123.123 \\"mysqldump -h localhost -u root -pPassWord dbName -d | gzip -cf\\" | gunzip -c > database1.sql 


ssh root@123.123.123.123 \\"mysqlbinlog /var/log/mysql/mysql-bin.* --start-datetime=\\"`date -d"1 day ago" +'%Y-%m-%d 00:00:00'`\\" --stop-datetime=\\"`date +'%Y-%m-%d 00:00:00'`\\" > tos1.txt

Incorrect date and time argument: 2009-11-06

_____

update: The problem was solved by escaping the space in the date command.

Last edited by shantanuo; 11-07-2009 at 02:52 AM.. Reason: resolved
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. Shell Programming and Scripting

Escape and command substitution in scripting

I have one question in shell script for escape "\" with command substitution "` `". I post there to seek help to understand how it works. My original one piece of code in script like this: This piece of code in whole script is working without errors chk_mode=`sqlplus -s /nolog<<EOF connect /... (4 Replies)
Discussion started by: duke0001
4 Replies

3. Shell Programming and Scripting

awk to escape space in name

I am searching a file and not able to escape a space if $i has a space in the name. I tried escaping it with a \ and also trying to add it to allow for spaces in the search. Neither are correct as the first awk only outputs path and the second awk doesn't run. Thank you :). first awk awk... (3 Replies)
Discussion started by: cmccabe
3 Replies

4. Shell Programming and Scripting

Auto escape script to escape special chars in script args

This is a bit off the wall, but I often need to run scripts where there are argument values that contain special characters. For example, $ ./process.exe -t M -N -o temp.mol.s -i ../molfiles/N,N\',N\'\'-trimethylbis\(hexamethylene\)triamine.mol && sfile_space_to_tab.sh temp.mol.s temp.s It... (1 Reply)
Discussion started by: LMHmedchem
1 Replies

5. Shell Programming and Scripting

Using awk with the date command and escape characters

I have a file that is a log file for web traffic. I would like to convert the timestamp in it to unix time or epoch time. I am using the date command in conjunction with awk to try to do this. Just myfile: 28/Aug/1995:00:00:38 1 /pub/atomicbk/catalog/home.gif 813 28/Aug/1995:00:00:38 1... (3 Replies)
Discussion started by: jontjioe
3 Replies

6. Shell Programming and Scripting

escape space characters in loop from file

Hi Everyone! I want to build sql inserts from a list of countries/regions saved in a file. The list looks like this: United Kingdom Czech Republic ... The script I run is: while read i; do var=`expr $var + 1`; echo "INSERT INTO calltypes VALUES($var, '$i','$i');" >>... (5 Replies)
Discussion started by: linuca
5 Replies

7. Shell Programming and Scripting

Escape space in for loop

I have a file with the following contents # more hello.txt man hello man whereru The shell script i have tries to echo the contents of the file hello.txt for i in `cat hello.txt` do echo $i done but the output i am getting is taking the space as a new line.. #... (3 Replies)
Discussion started by: Tuxidow
3 Replies

8. UNIX for Dummies Questions & Answers

The command for Unassigned Space

Hi, I want to know in windows we will go to disk Fragmentation to see the Unassigned space. In Linux/ Unix which command can we Use. I tried df -h, thats not the right answer. It shows the created partitions & the free space available in those Partitions. Can some one help.... Regards,... (1 Reply)
Discussion started by: shahid khan
1 Replies

9. UNIX for Dummies Questions & Answers

Both HOME and INSERT key send same escape sequence on ssh

I couldn't seem to make 'HOME' key work on my remote windows ssh client to a Fedora Core3 server (the home key works perfectly when i'm physically on site.) To my surprise, using control+V it seems that both my home and insert key send the same escape sequence ^So it must be my windows SSH client... (0 Replies)
Discussion started by: grossgermany
0 Replies

10. Linux

ssh: connect to host traviata port 22: No buffer space available

What does that mean? traviata being my distant host? What am i to do? (0 Replies)
Discussion started by: penguin-friend
0 Replies
Login or Register to Ask a Question
SSH-COPY-ID(1)						      General Commands Manual						    SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/autho- rized_keys file. If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file. If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or more fin- gerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the file, and directory, if necessary.) NOTES
This program does not modify the permissions of any pre-existing files or directories. Therefore, if the remote sshd has StrictModes set in its configuration, then the user's home, ~/.ssh folder, and ~/.ssh/authorized_keys file may need to have group writability disabled manu- ally, e.g. via chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys on the remote machine. SEE ALSO
ssh(1), ssh-agent(1), sshd(8) OpenSSH 14 November 1999 SSH-COPY-ID(1)