Just discovered in amazement that in Bash scripts, any variable named `SECONDS` will automatically increment every second. Bash is bonkers
This profile might be incomplete.
Open on mas.to Nathan Manceaux-PanotLinks:
Making:
Personal infoAbout:
Loves building tools, making art.
Wall 1 post
Just discovered in amazement that in Bash scripts, any variable named `SECONDS` will automatically increment every second. Bash is bonkers |
@Cykelero by the way, you should not define a variable in your script that’s comprised solely of uppercase letters, digits and underscore: these may be reserved by the implementation.
(A separate location in POSIX makes this logic mostly apply to shell variables.)
So, user variables in shell scripts should always be lowercase.
@Cykelero by the way, you should not define a variable in your script that’s comprised solely of uppercase letters, digits and underscore: these may be reserved by the implementation.
@Cykelero@mas.to
Primarily working on RHEL-based (and derivative) systems, a lot of the nifty BASHisms tend to be missing because the version of BASH is typically five or more years behind current.
#Linux