C-Shell “Variable syntax” problem

“Varible syntax” problem cause the shell can't return the value properly.

 

#!/bin/csh
set php_path = '/usr/bin/php'
$php_path test.php $argv
exit $?

  when you run this shell

system("test > test.log", $ret);

  the $ret is always 1, and run the real shell, there is varible syntax at the last. and it cause the the $ret value is always 1, And find if the shelll is C-shell, the return value capture return should be "$status" not "$?", after update the script, everything works fine

#!/bin/csh
set php_path = '/usr/bin/php'
$php_path test.php $argv
exit $status

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326530226&siteId=291194637