I'm used to being able to pass variables inside strings in ruby, like so
"message in double quotes #{expression_or_variable_to_run}"
What's the equivalent in bash, for really quick scripting?
I'm used to being able to pass variables inside strings in ruby, like so
"message in double quotes #{expression_or_variable_to_run}"
What's the equivalent in bash, for really quick scripting?
Is this what you're after?
#!/bin/bash
# Source hostname from command.
echo "Hostname is $(hostname)"
# Set hostname as string.
HOSTNAME="somestring"
echo "Hostname is ${HOSTNAME}"
Maybe this will help you understand some basics:
#!/bin/bash VARIABLE="is" echo "the server $VARIABLE `hostname`"
Variables are defined without $, referenced with $. Shell commands can be executed within `` quotes.