Jump to content

Echo current date in bash?

Go to solution Solved by Mr_KoKa,

$(date +"%b%-d_%Y_%H_%M_%S")

 

%d is day of month 01 to 31 %-d removes leading zero so it fits your needs.
 

 

Hello!

I would like to echo the current date in bash.

But not in number form. 

 

I would like to have the following:

 

echo $now

where now is the date in a form like this:

Aug1_2016_(minutes and seconds go afterwards, but I know how to implement that.)

Currently, the date that is echoed is: now=$(date +"%Y_%m_%d_%H_%M_%S")

I would like to have it in a format like this:

Aug1_2016_(rest of date)

and the date goes up with time.

Oct, Sep, Nov, etc..

 

Is this possible?

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
https://linustechtips.com/topic/640648-echo-current-date-in-bash/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×