Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bash built-in printf rather than external date command #24

Closed
Megver83 opened this issue May 29, 2022 · 1 comment
Closed

Use bash built-in printf rather than external date command #24

Megver83 opened this issue May 29, 2022 · 1 comment
Assignees

Comments

@Megver83
Copy link

Bash built-ins tend to be faster than external commands and preferred for shell scripts. date can be easily replaced with printf time format, like this example:

$ time date +%Y-%m-%d
2022-05-28
real    0m0,001s
user    0m0,001s
sys     0m0,000s
$ time printf "%(%Y-%m-%d)T"
2022-05-28
real    0m0,000s
user    0m0,000s
sys     0m0,000s

It kinda keeps the date format. Plus, it can be used to directly set variables with the -v option.
Just type printf --help for more info :D

@pedroetb
Copy link
Owner

I will take a look into this for next release, thanks!

@pedroetb pedroetb self-assigned this May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants