Skip to content

Comment on Filenames and Pathnames in Shell: How to Do It Correctly

Comments

Excellent article. The quick summary ([1]) is particulary good.

Note that quoting variable names is a good idea for other reasons, e.g., when a variable unexpectedly ends up empty: Not quoting such a variable can lead to termination in calls to test ([ ]), e.g., because the empty variable is replace with nothing (so that test sees the next non-whitespace token instead of the expected variable value, empty or otherwise), while quoting will at least cause the shell to correctly replace the variable with an empty string.

[1] http://www.dwheeler.com/essays/filenames-in-shell.html#summa...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.