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
Post a Comment