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
printfwith the%(datefmt)Tformat:-1means now.See The Bash reference at the
printfentry.To put it in a variable (and hence not use a subshell):