Post AkN8MExVKx6XmfvGNc by srtcd424@mas.to
(DIR) More posts by srtcd424@mas.to
(DIR) Post #AkIi362wsCsfCVq9z6 by Cykelero@mas.to
2024-07-25T18:01:04Z
2 likes, 3 repeats
Just discovered in amazement that in Bash scripts, any variable named `SECONDS` will automatically increment every second. Bash is bonkers
(DIR) Post #AkKbfU9rMgxFceLorA by lamp@kitty.haus
2024-07-26T18:55:40.737734Z
0 likes, 0 repeats
@Cykelero WTF
(DIR) Post #AkKbfsshRd5CIfVy52 by DrHyde@fosstodon.org
2024-07-25T19:28:03Z
0 likes, 1 repeats
@Cykelero it took me ages to track down that bug in one of my scripts a few months back. And when I say "track down" I mean "ineffectually whine for hours WHY DO YOU HATE ME? WHY IS THE COMPUTER DOING RANDOM STUPID SHIT?" until I asked someone on the internet and got an answer within approximately six seconds. Or was it seven? eight? nine? ...
(DIR) Post #AkKkACIqbBler9i6ee by reid@mastodon.cloud
2024-07-25T19:56:06Z
1 likes, 0 repeats
@Cykelero Holy crap.If I randomly do "echo $SECONDS", it seems to start at the number of seconds since the shell was launched.It does not show up in "env | grep SECONDS".Bonkers, like the man said.
(DIR) Post #AkN8MDqjSe5qLNkLBY by eisfunke@inductive.space
2024-07-25T19:24:38Z
0 likes, 0 repeats
@Cykelero didn't want to believe you, so I tried it and now I'm staring at my screen in disbelief#!/usr/bin/env bashSECONDS=3for i in $(seq 1 10); do echo $SECONDS sleep 1doneyields$ ./ohno.sh3456789101112
(DIR) Post #AkN8MExVKx6XmfvGNc by srtcd424@mas.to
2024-07-26T10:19:37Z
1 likes, 0 repeats
@eisfunke @Cykelero one of the few pleasures of getting old is watching people significantly younger than me being weirded out by this sort of thing for the first time :)