execute two shell commands in single exec php statement

Warrior picture Warrior · Aug 19, 2011 · Viewed 45.9k times · Source

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

the commands are

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

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

Answer

Marc B picture Marc B · Aug 19, 2011

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)