Wrap with multiline shell conditionals

This commit is contained in:
Philip Molloy 2018-04-30 17:18:07 -04:00
parent 1b206ee362
commit be87f493ae
No known key found for this signature in database
GPG Key ID: 5A8D520598BF9B9D

View File

@ -360,9 +360,21 @@ Revision 1.26
<STYLEPOINT title="Loops">
<SUMMARY>
Put <code>; do</code> and <code>; then</code> on the same line as the
<code>while</code>, <code>for</code> or <code>if</code>.
<code>while</code>, <code>for</code> or <code>if</code>, unless the line
exceeds the maximum line length.
</SUMMARY>
<BODY>
<p>
Example:
<CODE_SNIPPET>
if [[ -d "${LONG_PATH_TO_DIRECTORY}" &amp;&amp; \
-f "${LONG_PATH_TO_FILE}" &amp;&amp; \
! check_something ]]
then
delete_all_oracle_databases
fi
</CODE_SNIPPET>
</p>
<p>
Loops in shell are a bit different, but we follow the same principles
as with braces when declaring functions. That is: <code>; then</code>