in reply to Failure with rcp

I've just tried this:

#!/usr/bin/perl -w use strict; my ($Local, $Remote); $Local = q!localfile!; $Remote = q!user@host:dir!; system("rcp $Local $Remote"); exit(0);

and it works, copying the localfile in all it's pride and beauty.

The obvious difference is, that dir is below users $HOME and not an absolute path. But it works also -- just tested -- for $Remote = q!user@host:/tmp!;

The local system is an old Linux-box -- kernel 2.0.34 -- and the remote system is a RS/6000, runnig AIX 4.something.

vim

Replies are listed 'Best First'.
Re: Re: Failure with rcp
by jptxs (Curate) on Nov 19, 2000 at 07:27 UTC

    For speed, security, hatred of shells : ) and other reasons too many to list you may want to do it:

    system('rcp', "$Local", "$Remote");

    When you feed system the list it stops the shell from getting its grubby hands on it. See system for the exact process that happens when you call system.

    <myExperience> $mostLanguages = 'Designed for engineers by engineers.'; $perl = 'Designed for people who speak by a linguist.'; </myExperience>
RE: Re: Failure with rcp
by magnus (Pilgrim) on Oct 27, 2000 at 17:49 UTC
    Woo Hoo!! It worked!!! 64 Slices of American cheese for you, sir!! Thanks... btw, i haven't seen the q!..! syntax before... what's it mean?

    Update:without meaning to be a -- magnet, i wanted to remark that through another script, i found that the problem with this script was, i wasn't  close (FILE) before i rcp'ed... *sigh*... code and learn...
      q/.../ is identical to '...', or a single-quoted string. See perlop.

      Perhaps you were using double-quotes, and something in your string got interpolated, breaking it? That's why I kept trying to get you to test your assumptions, specifically: that these variables held the values you were expecting. That's why my examples had no variables at all, and I kept saying that if your example was any more complex than that (included variables, for example), then that additional complexity was almost certainly to blame. If I'm understanding all of this, it was.