Reputation: 2160
I am doing everything in a bash file. I am grabbing to variables from a parameter:
brand="$1"
email="$2"
Afterwards, I want to include on of them inside of a string:
cd /etc/nginx/sites-available/
echo 'server {
listen 80;
server_name $brand.mydomain.com;
root /srv/www/clients/$brand/soon;
}' >> default
But it echo's $brand.mydomain.com. How to echo the actual value which I am passing as parameter?
Upvotes: 0
Views: 1023
Reputation: 370
Single quotes don't allow for expansion of anything. Double quotes allow for expansion of variable, but you best enclose the name with parenthesis as shown.
echo "server {
listen 80;
server_name ${brand}.mydomain.com;
root /srv/www/clients/${brand}/soon;
}" >> default
Upvotes: 1