Define variable with single quotes in it's value - linux shell

Anybody out there who knows how to define a variable with a value like “What’s your name?” , including the double quotes around it? Please notice the single quote!
If it didn’t have the single quote, VARNAME=’“Whats your name?”’ would do the trick.

You probably need to use escape characters.

Both work, depending on the type of quotes you are using.

Usually, intentionally using ‘smart quotes’ is not, in fact, what you want.

Hi, the difficulty arose because it was not clear to me that the .sh files were to be edited directly, so I was doing it through the terminal. So the problem was defining a variable including single quotes inside an echo statement that then introduces the definition of the variable in the script. If it is done directly in the script there is no problem .

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.