Is it possible to get current time ( and possibly date ) without doing it via a subshell?
because if I'm not mistaken, this command do open a subshell?
d=$(date)
Is it possible to get current time ( and possibly date ) without doing it via a subshell?
because if I'm not mistaken, this command do open a subshell?
d=$(date)
Copyright © 2021 Jogjafile Inc.
With Bash≥4.2 you can use
printf
with the%(datefmt)T
format:-1
means now.See The Bash reference at the
printf
entry.To put it in a variable (and hence not use a subshell):