How to echo current datetime in Linux bash shell

You can get curent datetime in Linux bash shell with commands as following:


Then in the bash shell file you can print current datetime with echo command like below:

echo "Current date: $now" 

The final example looks like this:

echo "[$now]Setting environment parameter ..." 
Related:  How do you scroll up/down on the Linux console?

Leave a Reply

Your email address will not be published. Required fields are marked *