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

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


This will do it:

 echo "Hi, today is $(date)"


Date time will take in an arbitrary format string.

> date +"Hi, today is - %a %b %e %H:%M:%S %Z %Y"  Hi, today is - Thu Feb 2 03:28: CET 2012


echo Hello there, today is `date`

You can also format the output of date using modifiers like:

echo Hello there, today is `date +%D`

See man date for a complete list of the modifiers.