Advertisement

11.28.2008 at 08:10AM PST, ID: 23942396 | Points: 500
[x]
Attachment Details

system call to a Unix shell script utility fails with code 256 ($?)

Tags:

Open source, CGI in PERL, 5.8, system call, 256

I have a CGI script written in Perl, issuing a system call for a utility I wrote with Bash shell script. The utility attempts to create a new file.  

I capture the command (print it on the web page), copy and paste it into the command line and from there it works perfectly.
I can also use the same utility for reading files and directories with no trouble (thru the Perl script), only the creation of new file fails.

Thanks
Jack
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
$topicn=$_[0];
$txt=$_[1];
$topictime=time();     # EPOCH TIME WILL BE THE KEY (IN SECONDS GRANULARITY)
$wcommand="/home/js3104/simplestore write N15928458/topic/$topicn/$topictime \"$txt\"";
`$wcommand`;           # WRITE A NEW VERSION (OR FIRST) OF A TOPIC
 
if ( "$?" != 0 ){
$error="Cannot update topic at the moment, error code: $? $! $wcommand";               
}
#### utility name: simplestore
 
Expert Comment by Tintin:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Author Comment by js3104:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Expert Comment by Tintin:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
20081119-EE-VQP-45 - Hierarchy / EE_QW_2_20070628