$? Is a child error status and it works in perl too. Try to print it out and see what it says.
On 9/3/08 3:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a script in which I distribute directories to host. I use > either rdist or scp based on their OS. For example older sun machines > need rdist while newer machines can use scp. For some reason the > function below only resorts to scp. what I would like to do is an if/ > then statement. I know in ksh you can use $? to check if the command > was sucessful - anything similiar in perl? > > All the variable such as $args, $srcdir, etc are already predefined > via variables. I am just including the area where I am having an > issue. > ...{ > if ($host eq $hostname) {next;} > {$cmd="/usr/bin/rdist $args $srcdir $ > {host}:$destdir 2>&1";} > else {$cmd="/usr/local/bin/scp > $scpargs $srcdir ${host}:/ 2>&1"; } > } >