Bash: How to put hostname between quotes in file -


i try add hostname of server in file fails. tried:

host=`hostname` echo ' "server": "${host}"' >> /myfile 

and tried:

echo ' "server": "`hostname`"' >> /myfile 

it's important know need output in file:

"server": "ip-133..." 

try this:

$ echo "\"server\": \"$(hostname)\"" >> myfile 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -