Skip to main content
Post Closed as "Duplicate" by Gilles 'SO- stop being evil' bash
edited tags
Link
Gilles 'SO- stop being evil'
  • 866.5k
  • 205
  • 1.8k
  • 2.3k
added 19 characters in body
Source Link
Tim
  • 107k
  • 235
  • 651
  • 1.1k

From https://unix.stackexchange.com/a/32227/674

The main places where it's safe not to use the double quotes are:

  • in an assignment: foo=$bar (but note that you do need the double quotes in export "foo=$bar" or in array assignments like array=("$a" "$b"));
  1. Why isDoes it mean that it is not required to double quote $bar in assignment foo=$bar? Why?

  2. Why do we need the double quotes in export "foo=$bar" and in array assignments like array=("$a" "$b")?

Thanks.

From https://unix.stackexchange.com/a/32227/674

The main places where it's safe not to use the double quotes are:

  • in an assignment: foo=$bar (but note that you do need the double quotes in export "foo=$bar" or in array assignments like array=("$a" "$b"));
  1. Why is it not required to double quote $bar in assignment foo=$bar?

  2. Why do we need the double quotes in export "foo=$bar" and in array assignments like array=("$a" "$b")?

Thanks.

From https://unix.stackexchange.com/a/32227/674

The main places where it's safe not to use the double quotes are:

  • in an assignment: foo=$bar (but note that you do need the double quotes in export "foo=$bar" or in array assignments like array=("$a" "$b"));
  1. Does it mean that it is not required to double quote $bar in assignment foo=$bar? Why?

  2. Why do we need the double quotes in export "foo=$bar" and in array assignments like array=("$a" "$b")?

Thanks.

Source Link
Tim
  • 107k
  • 235
  • 651
  • 1.1k

Why is it not required to double quote `$bar` in assignment `foo=$bar`?

From https://unix.stackexchange.com/a/32227/674

The main places where it's safe not to use the double quotes are:

  • in an assignment: foo=$bar (but note that you do need the double quotes in export "foo=$bar" or in array assignments like array=("$a" "$b"));
  1. Why is it not required to double quote $bar in assignment foo=$bar?

  2. Why do we need the double quotes in export "foo=$bar" and in array assignments like array=("$a" "$b")?

Thanks.