I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Worth pointing out that relying on external commands is not portable (in this case it's specific to BSD date) and that you could also pipe the system command through | tr -d "\n" to get rid of any trailing newlines.
There’s some more about the differences between BSD and GNU date in the original. You’re right, though; using external dependencies makes this less portable.
I used the nested substitution to show another crazy thing you can do within a substitution. Piping the result from the date command through tr is probably easier to remember, so I'll add a quick note about that. Thanks!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is really cool.
Worth pointing out that relying on external commands is not portable (in this case it's specific to BSD
date
) and that you could also pipe the system command through| tr -d "\n"
to get rid of any trailing newlines.Hey Ben, 👋
Thanks for your kind words!
There’s some more about the differences between BSD and GNU date in the original. You’re right, though; using external dependencies makes this less portable.
I used the nested substitution to show another crazy thing you can do within a substitution. Piping the result from the
date
command throughtr
is probably easier to remember, so I'll add a quick note about that. Thanks!