Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有关shell脚本和php的信息_Php_Shell_Sh - Fatal编程技术网

有关shell脚本和php的信息

有关shell脚本和php的信息,php,shell,sh,Php,Shell,Sh,我想知道一些事情: 我有一个shell脚本,其中包含一些php脚本 当第一个php脚本完成后,第二个将启动 但问题:如果第一个脚本被致命错误或骰子()中断,第二个脚本是否执行?运行它并找出答案,否则您在这里有两个选项(可能更多): 检查第一个php命令后的返回代码 php -f ./file1.php if [[ $? != 0 ]]; then echo "php failed" exit 1 fi php -f ./file2.php 用&& php -f ./file1.

我想知道一些事情:

我有一个shell脚本,其中包含一些php脚本

当第一个php脚本完成后,第二个将启动


但问题:如果第一个脚本被致命错误或骰子()中断,第二个脚本是否执行?

运行它并找出答案,否则您在这里有两个选项(可能更多):

检查第一个php命令后的返回代码

php -f ./file1.php
if [[ $? != 0 ]]; then
    echo "php failed"
    exit 1
fi
php -f ./file2.php
&&

php -f ./file1.php && php -f ./file2.php

首先,显示您的代码,其次,您需要什么?如何启动第二个脚本?运行shell脚本,在第二个php脚本中进行一些明显的调试,查看是否将其输出到终端?@bahamut100-put
die()
,位于第一个php脚本的顶部。将回声“hello”放在第二个的顶部。然后运行shell脚本并查看。