help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simpler question about my script


From: Sysadmin Lists
Subject: Re: simpler question about my script
Date: Fri, 18 Feb 2022 00:06:05 +0100 (CET)

> ----------------------------------------
> Message: 1
> Date: Tue, 15 Feb 2022 17:17:19 -0600
> From: Dennis Williamson <dennistwilliamson@gmail.com>
> To: Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
> Cc: help-bash <help-bash@gnu.org>
> Subject: Re: simpler question about my script
> 
> A few tips (some are specific to shell scripts):
> ....
> Avoid being clever. Clarity is important. Avoid side effects whenever
> possible.
> ....
> Know when and why to bend the rules, but keep it to a minimum.
> 
> Some of these tips are intended to draw a distinction between command-line
> use where brevity has value and scripting where clarity is a higher
> priority.

That's an excellent list except for the (qualified) part about cleverness, IMO. 
If you read through old (I mean 70s and 80s) code, it's stuffed with 
cleverness. Being clever forces a deeper understanding of the language in use, 
forces brevity, and forces tight flow-control. It doesn't take away from 
readability if you comment your code well (which is also a dying art probably 
tied to the advice about cleverness). I see "avoid being clever" becoming "be 
lazy" in the real world.

-- 
Sent with https://mailfence.com  
Secure and private email



reply via email to

[Prev in Thread] Current Thread [Next in Thread]