Can I echo a variable with single quotes?

Viewed 48775

Can I echo in single quotes with a variable?

example

echo 'I love my $variable.';

I need to do this because I have lots of HTML to echo too.

11 Answers

Try this

<php echo 'I love my '. $variable . ' .'; ?>

In my case, I have changed my command as follows and it worked for me:Added double quotes twice("") beside every single quote(')

PVALUE='1,2,3'
echo "variable='""${PVALUE},repmgr'""" >>postgresql.conf
  • Output:

    variable='1,2,3,repmgr'

#How to print a variable in echo within a single quote bash shell script

Related