My keyboard only has normal quotes, not the smart ones.
I have observed that I need normal ones in CGI development and the backward ones in AWK/SED.
Is there a rule when I should use smart quotes, normal ones and backward ones?
Obviously, I need to edit my keyboard layout to get the smart quotes.
If you mean
`by smart quotes, then that is actually called ‘backquote’. Smart quotes are when you type ‘ and ‘, but get ‘ and ’ or “ and ” automatically depending on the context. I’m not sure how you would use smart quotes in awk or sed.In the shell, backquotes, such as
`command`, are used to evaluate a command and substitute the result of the command within them into the shell expression being evaluated; it can be used to compute and argument to another command, or to set a variable. For less ambiguity, you can instead use$(command), which makes a lot of quoting rules easier to work out.In the shell,
'and'are also different.'is used for strings in which you want variable substitution and escape sequences.'represents a string containing just the characters within the quotes, with not variable interpolation or escape sequences.So, for example:
Other scripting languages, such as Perl and Ruby, have similar rules, though there may be slight differences.