S
S
Sergey Goryachev2016-05-04 23:13:26
linux
Sergey Goryachev, 2016-05-04 23:13:26

How to write date and time in BASH script?

I want to write a small bash script that will send my files to git.
I can’t catch up, how can I write the date and time instead of a comment?

git commit -a -m "comment"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
viiy, 2016-05-04
@webirus

git commit -a -m "comment `date +"%Y%m%d %H:%M"`"
or
git commit -a -m "comment $(date +"%Y%m%d %H:% M")"
select the desired date format from "man date"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question