在单个exec php语句中执行两个shell命令 [英] execute two shell commands in single exec php statement

查看:105
本文介绍了在单个exec php语句中执行两个shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示在指定日期之后修改的所有文件

I want to display all the files that are modified after a specified date

命令是

touch --date '2011-09-19 /home/  , find /home/

我如何在单个exec语句中执行这两个命令.预先感谢

How i can execute this two commands in single exec statement.Thanks in advance

推荐答案

您可以使用;&&分隔命令. ;无条件运行两个命令.如果第一个失败,则第二个仍然运行.使用&&会使第二个命令依赖第一个命令.如果第一个命令失败,第二个命令将不会运行.

You can use either a ; or a && to separate the comands. The ; runs both commands unconditionally. If the first one fails, the second one still runs. Using && makes the second command depend on the first. If the first command fails, the second will NOT run.

command1 ; command2     (run both uncondtionally)
command1 && command2     (run command2 only if command1 succeeds)

这篇关于在单个exec php语句中执行两个shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆