[GTALUG] Script to show HTTP(S) and TLS details for a website

Chris F.A. Johnson chris at cfajohnson.com
Sat Sep 14 15:28:02 EDT 2019


On Sat, 14 Sep 2019, D. Hugh Redelmeier via talk wrote:

> | From: William Park via talk <talk at gtalug.org>
>
> | Hmm, minor personal irritant about variable assigment:
> |     var=$(...)
> | is enough.  You don't need to do
> |     var="$(...)"
>
> I think that getting quotes right in sh is hard.  I support the
> simplest rule that works:
>
> Always double-quote a $ thing UNLESS it must not be quoted.
>
> The case you point out may be quoted, so I would quote it.

The only time an assignment needs to be quoted is when it contains literal whitespace.

Using quotes on an assignment is just as silly as always using braces: echo "${var}"
You don't always do it just because sometimes it is needed.

-- 
    Chris F.A. Johnson                         <http://cfajohnson.com/>
    =========================== Author: ===============================
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
    Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)


More information about the talk mailing list