[mdlug] Difference between ; and &&

Brian Brodsky brianbrodsky at ameritech.net
Wed May 9 09:08:58 EDT 2012


Actually commands return a result code of 0 (usually means false) if 
successful and some exception value if not. So if successful it will 
return 0 which means it has to run the second command to see if the and 
condition is met, any exception would be a value so the second command 
does not have to be run since the expression is true.

On 5/9/2012 8:29 AM, James Hice wrote:
> For ;  each command is executed
> For&&  the second command is only executed if the first returns true
> On May 9, 2012 8:12 AM, "Mat Enders"<mat.enders at gmail.com>  wrote:
>
>> Hello all,
>>
>> When stringing commands together at the command line I always use the
>> semicolon ;  I however see&&  used frequently and was wondering what
>> the difference was.
>>
>> For example what is the difference between these commands:
>>
>> apt-get update;apt-get dist-upgrade
>> and
>> apt-get update&&  apt-get dist-upgrade
>>
>> --
>> Mathew E. Enders
>>
>> "Where once Samba and Apache sold Linux to the world they are now just
>> part of the plumbing.  But that's OK, plumbers make good money."
>> --Jeremy Allison
>> _______________________________________________
>> mdlug mailing list
>> mdlug at mdlug.org
>> http://mdlug.org/mailman/listinfo/mdlug
>>
> _______________________________________________
> mdlug mailing list
> mdlug at mdlug.org
> http://mdlug.org/mailman/listinfo/mdlug
>



More information about the mdlug mailing list