[ale] Anyone want to crtique a shell script?
Alex Carver
agcarver+ale at acarver.net
Sun Apr 12 20:49:30 EDT 2015
On 2015-04-12 17:37, Leam Hall wrote:
> On 04/12/15 20:31, Alex Carver wrote:
>> On 2015-04-12 16:36, Leam Hall wrote:
>
>>> On 04/11/15 18:37, Alex Carver wrote:
>>>> First, a lot of your statements are missing semicolons. You'll need
>>>> those or bash will complain.
>>>
>>> Haven't seen it choke yet. Do you see any edge cases I'm not thinking
>>> about?
>>
>> Usually it starts to show up when control structures are nested. You
>> can end up with a case where the control structure follows an undesired
>> logic flow. I just do it explicitly so I don't have to think about
>> introducing possible hierarchical errors and others can read it later.
>
> That makes sense. I used to use them all the time and then started
> playing with Python and Ruby. Lost the habit. I really prefer
> semi-colons to:
> end
> end
> end
> end
> end
:) Yeah, that would be annoying and is also a reason that I dislike
Python's use of white space. I'm trying my best to learn it but it's
unfortunate that it distinguishes whitespace in general and types of
whitespace (I get stuck with lots of issues with tabs versus spaces).
Bash's control structures still have closing statements (do/done, if/fi,
etc.) but I've found that the semicolons can ensure that the hierarchy
is enforced. I had one case where a statement was executed out of order
because of the missing semicolon.
More information about the Ale
mailing list