Linux: bash

More information:

Advanced Bash-Scripting Guide



Quoting means just that, bracketing a string in quotes. This has the effect of protecting special characters in the string from reinterpretation or expansion by the shell or shell script. A character is “special” if it has an interpretation other than its literal meaning. For example, the asterisk * represents a wild card character in globbing and Regular Expressions.


There are no data types. A variable in bash can contain a number, a character, a string of characters. You have no need to declare a variable, just assigning a value to its reference will create it.

Create a variable called STR and assigns the string “Hello World!” to it. Then the VALUE of this variable is retrieved by putting the ‘$’ in at the beginning. Note that $STR is actually a simplified form of ${STR}. In contexts where the $STR syntax causes an error, the longer form may work. No space permitted on either side of = sign when initializing variables.

STR="Hello World!"
echo $STR


Leave a Reply