3 ms·
Arithmetic expressions in shell scripts
- dotandimet 15y agoThe title is far from being sexy or linkbaiting, but behind it's demure umbrella is an excellent rant - both informing and entertaining. Two quotes for flavor: "C is a language that combines the power of raw assembly with the expressiveness of raw assembly." "(expr $x+$y) fails because the craptastrophic lexer (a whole 12 lines of C code) assumes that each command argument will be a single token, and makes no effort to actually do any, you know, lexing." Hopefully this will teach me to use bc or $((...)) the next time I try to do math in a terminal.