Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • $(( .. )) itself is POSIX, so it's likely to be supported in any sensible sh. Exponention with ** isn't standard, though, and e.g. Dash indeed doesn't support it. Commented Jul 26, 2023 at 11:44
  • @ilkkachu also, at least my bash doesn't let me do anything but integer math, whereas my zsh does $(( 3.1416 ** 0.5 )) (it also does **, and logical ^^; I think that's it for missing features from bash, but I do have to say, not being able to do floating point math hurts.) Commented Jul 26, 2023 at 19:45
  • 1
    @MarcusMüller, Yes, floating point math also isn't standard, and Bash doesn't support it. It's no surprise zsh is more featureful, and ksh also supports floats, but that's one of the things Bash hasn't copied off the two. I'm not saying there's no reason to use Perl over a shell here, just that $(( ... )) not being available in a POSIX sh isn't one. Commented Jul 26, 2023 at 21:36