0

I learned shell scripting for a little while and decided to recreate this question's accepted answer, though I can't really find how a DateTime equivalent would be in it.

How can I get a DateTime command? (In relation to Date time in Linux bash)

Jens
  • 69,818
  • 15
  • 125
  • 179

1 Answers1

0

You can get the date by passing the date argument when declaring a variable:

var=$(date '+%d/%m/%Y %H:%M:%S');

And as pointed out by @Cyrus, you can also not use date via:

printf -v var "%(%d/%m/%Y %H:%M:%S)T\n" -1