Consider I've set variable site
and needs to be printed by echo
or printf
, but If I use single quote to write something and want to use variable then how?
Example:
$ site=unix.stackexchange.com
$ echo "visit:$site"
visit:unix.stackexchange.com
But If I use single quote:
$ echo 'visit:$site'
visit:$site
Then we know that ''
is strong quote and will not expand the variable
I've tried something:
$ echo 'visit:"$site"'
visit:"$site"
but do not succeed. So, I am looking for way to print value inside variable while using single quote.