... or you can invoke the external script with a full path, as in
system 'sh /home/folder1/folder2/test1.sh';
But you are doing something very wrong, which is the cause of your error: system($cmd) or die "none"
Infact system is not like open from the docs:
The return value is the exit status of the program as returned by the wait call. To get the actual exit value, shift right by eight (see below). See also exec.
system sets $? and if you need to inspect the returned status you need something like this (again from the docs):
if ($? == -1) {
print "failed to execute: $!\n";
}
elsif ($? & 127) {
printf "child died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf "child exited with value %d\n", $? >> 8;
}
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
|