The && operator

You can use the && operator to execute a command and, if it is successful, execute the next command in the list. For example:

   cmd1 && cmd2

cmd1 is executed and its exit status examined. Only if cmd1 succeeds is cmd2 executed. This is a terse notation for:

   if cmd1 
   then
     cmd2
   fi

[Home] [Search] [Index] This site maintained by unixhelp@ed.ac.uk