3 ms·
It's safe to omit quotes for POSIX shell variables that are initialized as numeric, and you enforce to remain numeric. All else should be quoted, and newlines
by chasil 5y ago
It's safe to omit quotes for POSIX shell variables that are initialized as numeric, and you enforce to remain numeric.
All else should be quoted, and newlines can happen, primarily from abuse. Do not trust user input!
Calling fopen() on a file with every ASCII character will work on POSIX, as long as it does not contain a null or forward slash (/). Coding defensively means that this does not crash your processing.
- kwhitefoot 5y agoI'm not objecting to quoting; I do it even when the variable contains, or should contain, a number. I was objecting to the knee jerk inclusion of warnings against file names including newlines. Has anyone encountered one in the wild that was not itself an error?