Search code examples
unixdateecho

How do I append the UNIX command date to an echo statement


Basically I want to have the terminal output a message followed by the date and time, like "Hi, today is -dateandtime-".

So echo can accomplish the first bit, and date can accomplish the last, but only separately, how can I put them together (in one command) so they output together.

Like

echo hello there

-new command-

date

Does it, but not in one line. Is pipelining the answer?


Solution

  • This will do it:

     echo "Hi, today is $(date)"