On Sat, Jun 24, 2023, at 8:04 PM, dan b wrote:
> As I understand it;
> Add quotes if the variable will contain either an empty value, contain
> spaces or whitespace, or special characters such as wildcards. Not
> double quoting strings with spaces often leads to the shell breaking
> apart a single into multiple arguments.
This is true in general, but not always. Neither field splitting
nor filename generation are performed on the RHS of a simple
assignment.
var=$this_is_fine
However, you would have to take care with something like this.
var=$(cmd "$quote_this_one")
> In my case a had a username csv list while done read with
> “firstname.lastname”, and “first-initial-lastname” that may or may not
> have also been bound with white space or tabs as well.
> By not double quoting, the dots between the names were changing to
> spaces. The argument was wrapped in a sed statement to remove white
> space, so the firstlast name were concatenates together….
There is no way that the dots were changed to spaces through a mere
lack of quoting. Something else in your code did this, and you are
misattributing it.
--
vq