[SOLVED] Variables and quotes in bash
by iicapn from LinuxQuestions.org on (#56MQX)
I'm trying to run this command but having trouble with the variable part:
Code:echo '/^From:[[:space:]]+(.*)/ REPLACE From: "$hostname" hi.there@gmail.com' > /etc/postfix/header_checkI want the $hostname to be replaced with the variable I set earlier (while keeping the double quotes). But it's being written to the file as the string literal $hostname
Would very much appreciate some tips on how best to think about how to solve this. Thank you!


Code:echo '/^From:[[:space:]]+(.*)/ REPLACE From: "$hostname" hi.there@gmail.com' > /etc/postfix/header_checkI want the $hostname to be replaced with the variable I set earlier (while keeping the double quotes). But it's being written to the file as the string literal $hostname
Would very much appreciate some tips on how best to think about how to solve this. Thank you!