0

I have an rsync command that works fine from either the Bash command line or a Bash script.

The command is: rsync -qtz user@hostname:/tmp/p /tmp

When I run the command, it copies the file and runs in less than a second.

If I put the command in a Perl script, the script hangs, and I have to Control-C to kill it.

The Perl script is just this:

system("rsync -qtz user@hostname:/tmp/p /tmp");

What could be going wrong? Other commands (like mv and gzip) work fine in the Perl script. I tried specifying the4 complete path to /usr/bin/rsync, but it doesn't help.

1 Answer 1

1

The @ symbol is special inside double quoted strings in Perl.

It is trying to find an array named @hostname and expand it. @hostname is not set, so it is expanding to rsync -qtz user:/tmp/p /tmp.

Try

system("rsync -qtz user\@hostname:/tmp/p /tmp");

instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .