Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am writing script were rsync should be called and ask for password. However I cannot pass IP as argument. I think I am missing something simple. Any ideas? Even trivial script like this just outputs nothing, just stucks:

rsync -avzh -P $1 $3@$2:/opt/stuff/

When I put IP it worked:

rsync -avzh -P $1 $3@192.168.0.100:/opt/stuff/

Tried escaping colon, didn't helped, echo'ed everything and it just showed similar line. I think it is something related to interactivity.

share|improve this question
    
Are you sure about the value of $2 at that point? Print it out with printf '[%s]\n' "$2" | cat -v to check that it contains the IP address only. –  Gilles Feb 10 at 8:40
    
In my case I got [192.168.1.100] no hidden symbols, nothing –  IBr Feb 10 at 8:58
    
Run your script with the -x flag: sh -x myscript dirname address username. This will show you how sh interprets your script. –  Warren Young Feb 10 at 9:12
    
+ rsync -avzh -P ../file.txt user@192.168.1.100:/opt/stuff - perfect, but still same results. –  IBr Feb 10 at 9:16
    
Wait after some time I got: "ssh: connect to host 192.168.1.100 port 22: Connection timed out rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0] " –  IBr Feb 10 at 9:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.