This question already has an answer here:

Is there any reason for doing something like:




The quotes seem completely superfluous, but then there might be some hideous corner case... I'm interested in Bash and Sh in particular, but answer about the other ones as well if you can and will.

marked as duplicate by Jeff Schaller, Kusalananda bash Jun 17 '18 at 6:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    The only reason I quote the right hand side of an assignment like that (static string) is if anyone later decides that they'd want a space in the string (e.g. it's a long pathname that someone might modify, not realizing it's unquoted). – Kusalananda Jun 17 '18 at 6:49
  • 1
    Sure, you could drop the quotes for simple cases like that, but I don't advise it. You want to train your brain so that quoting becomes second nature. That way, you're much less likely to forget to quote when it's critical to do so, and you'll find it easier to debug, since stuff with missing quotes will look obviously wrong. – PM 2Ring Jun 17 '18 at 10:17

Browse other questions tagged or ask your own question.