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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -