jalebie has asked for the wisdom of the Perl Monks concerning the following question:
use strict; #create the file mine.txt if doesn't exist if (! -e "mine.txt") { system("echo 'hey you' > mine.txt"); } #delete the file min.txt if exists if (-e "min.txt") { print "File unlink.txt ".unlink(<min.txt>)."deleted \n"; } my $cmd1 = "rcp mine.txt cmd1.txt"; my $cmd2 = "rcp min.txt cmd2.txt"; my ($val1, $val2); if ($val1 = system("$cmd1")) { print "$cmd1 failed \n"; } if ($val2 = system("$cmd2")) { print "$cmd2 failed \n"; } print "val1: $val1 \n"; print "val2: $val2 \n"; print " done \n";
cp: cannot access min.txt val1: 0 val2: 0 done
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unix rcp command within a system call
by Monky Python (Scribe) on Aug 28, 2001 at 20:59 UTC | |
by jalebie (Acolyte) on Aug 28, 2001 at 21:38 UTC | |
|
Re: unix rcp command within a system call
by jlongino (Parson) on Aug 28, 2001 at 21:15 UTC | |
by jalebie (Acolyte) on Aug 28, 2001 at 21:43 UTC | |
by jlongino (Parson) on Aug 28, 2001 at 23:16 UTC |