Timeline for Small bash script to quickly edit scripts in $PATH
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 25, 2021 at 19:04 | vote | accept | Elias Van Ootegem | ||
Mar 25, 2021 at 19:04 | comment | added | Elias Van Ootegem | cheers. In that case, I'll stick to the square brackets for bash scripts. Implemented pretty much all of the other suggestions you made. | |
Mar 25, 2021 at 18:36 | comment | added | glenn jackman |
((...)) does not play well with set -e though: if the arithmetic expression evaluates to zero, the return status is 1 -- makes it good for conditions, but can be confusing source of errors.
|
|
Mar 25, 2021 at 18:34 | comment | added | glenn jackman |
Just a personal preference. ((...)) allow you to assign variables within it , and also to refer to variables without $ to create readable C-like expressions -- ((sum += hours * hourly_rate))
|
|
Mar 25, 2021 at 17:55 | comment | added | Elias Van Ootegem |
Thanks for the input. The colon function felt dirty to write indeed. Just out of curiosity: any specific reason to use (()) for numeric comparisons over [ -eq ] & co? I get why one would prefer using > of -gt , but oddly enough, I find myself making less silly mistakes using the latter (I probably mess up < vs > at least once a week - embarrassing, I know)
|
|
Mar 25, 2021 at 17:45 | history | edited | glenn jackman | CC BY-SA 4.0 |
added 406 characters in body
|
Mar 25, 2021 at 17:39 | history | answered | glenn jackman | CC BY-SA 4.0 |