Timeline for Why do I need to quote variable for if, but not for echo?
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 22, 2013 at 9:17 | comment | added | user | @CharlesB It only outputs the value of $test if that does not contain multiple spaces anywhere. Try the program in my answer for an illustration of the reason. | |
| Feb 21, 2013 at 22:05 | comment | added | CharlesB | I don't need them, I can echo $test and it works (it outputs the value of $test) | |
| Feb 21, 2013 at 21:37 | comment | added | Gilles 'SO- stop being evil' | @CharlesB You do need the quotes for echo. What makes you think otherwise? | |
| Feb 21, 2013 at 15:06 | history | undeleted | h3rrmiller | ||
| Feb 21, 2013 at 14:04 | history | deleted | h3rrmiller | ||
| Feb 21, 2013 at 13:54 | history | edited | h3rrmiller | CC BY-SA 3.0 | added 80 characters in body |
| Feb 21, 2013 at 13:51 | comment | added | CharlesB | yes but why don't we need it for echo? | |
| Feb 21, 2013 at 13:48 | history | answered | h3rrmiller | CC BY-SA 3.0 |