I want to create a echo statement in a Bash script that will say "Today is (current date and time)".
so far I've tried:
today=date
echo Today is $today
but no luck
I want to create a echo statement in a Bash script that will say "Today is (current date and time)".
so far I've tried:
today=date
echo Today is $today
but no luck
To embed commands into other ones, either wrap them in
``
or in$()
.Examples:
the right one is:
In other words, use the
variable=$(commands)
syntax, it will save the result of command intovariable
and so if you want to printout the what was the result? you can use:here is the similar example http://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/