[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: what is &&
From: |
CARTER-HITCHIN, David, GBM |
Subject: |
RE: what is && |
Date: |
Fri, 31 Mar 2006 13:14:27 +0100 |
> What is the difference between:
> cd dir; do_smth
cd into dir then run do_smth; if 'cd dir' fails, then run do_smth anyway
> and
> cd dir && do_smth
cd into dir then run do_smth; if 'cd dir' fails then don't run do_smth
It's a logic control statement meaning AND so
cmd1 AND cmd1
is evaluated by the shell for 'truth'. If the first statement is false
(i.e. cmd1 fails), then this short-circuits the logic as the shell doesn't
need to know the truth/falsehood of the second 'statement' (cmd2), so it
doesn't evaluate it. So 'a && b' is equivalent to 'if a then b'. || (or)
has similar uses. See the man page for the shell you are using for more
details, e.g. 'man ksh' on my system has some info about this idiom.
HTH,
David Carter-Hitchin.
--
Royal Bank of Scotland
Interest Rate Derivatives IT
135 Bishopsgate
LONDON EC2M 3TP
Tel: +44 (0) 207 085 1088
***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered
Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorized and regulated by the Financial Services Authority
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The Royal
Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
http://www.rbos.com
http://www.rbsmarkets.com
********************************************************************************
- what is &&, Angel Tsankov, 2006/03/31
- RE: what is &&,
CARTER-HITCHIN, David, GBM <=