
On Sat, 14 Sep 2019, D. Hugh Redelmeier via talk wrote:
| From: William Park via talk <talk@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)