2
$ volume=vol1
$ echo $volume 
vol1

$ volume="vol1"
$ echo $volume 
vol1

$ volume='vol1'
$ echo $volume 
vol1

What is the difference between the above in bash scripting? All are one and same?

kumar
  • 2,530
  • 6
  • 33
  • 57
  • Duplicate to http://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash . Consider to [close](https://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled) – jschnasse Mar 16 '17 at 09:58

1 Answers1

1

You'll probably find the definitive answer on that wiki.

Short answer: the quote are needed arround $volume.

Aif
  • 11,015
  • 1
  • 30
  • 44
  • From the wiki, The basic rule of thumb is that you should double-quote every expansion. This prevents unwanted word splitting and globbing. When in doubt, quote it. :) – kumar Mar 16 '17 at 10:19