Skip to main content

single Single quote within double quotes and the bashBash reference manual

In section 3.1.2.3 titled Double Quotes, the bashBash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote(').

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable aa is not defined (hence $a$a = null string), should print $a on the screen, as '', having it's special meaning inside, would shield $ from the special interpretation. Instead, it prints ''. Why so?

single quote within double quotes and the bash reference manual

In section 3.1.2.3 titled Double Quotes, the bash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote(').

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable a is not defined (hence $a = null string), should print $a on the screen, as '', having it's special meaning inside, would shield $ from the special interpretation. Instead, it prints ''. Why so?

Single quote within double quotes and the Bash reference manual

In section 3.1.2.3 titled Double Quotes, the Bash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote(').

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable a is not defined (hence $a = null string), should print $a on the screen, as '', having it's special meaning inside, would shield $ from the special interpretation. Instead, it prints ''. Why so?

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
Tweeted twitter.com/#!/StackUnix/status/536491573941641216
added 4 characters in body
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

In section 3.1.2.3 titled Double Quotes, the bash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote("'"').

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (‘'’') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable a is not defined (hence $a = null string), should print $a on the screen, as '''', having it's special meaning inside, would shield $$ from the special interpretation. Instead, it prints ''. Why so?

In section 3.1.2.3 titled Double Quotes, the bash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote("'").

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable a is not defined (hence $a = null string), should print $a on the screen, as '', having it's special meaning inside, would shield $ from the special interpretation. Instead, it prints ''. Why so?

In section 3.1.2.3 titled Double Quotes, the bash manual says:

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

At the moment I am concerned with the single quote(').

It's special meaning, described in the preceding section, section 3.1.2.2 is:

Enclosing characters in single quotes (') preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Combining the two expositions,

 echo "'$a'" 

where variable a is not defined (hence $a = null string), should print $a on the screen, as '', having it's special meaning inside, would shield $ from the special interpretation. Instead, it prints ''. Why so?

Source Link
Lavya
  • 1.7k
  • 5
  • 23
  • 28
Loading