This is for the big guns...
I have been modifying AudioScope.sh to bring it inline with more current practices.
I hit a bug which IS not present in the original code but was after modification.
Shell check first:-
#!/bin/sh
txt="1234567890"
echo "$(( $txt ))"
echo "$(( ${#txt} - 1 ))"
echo "$(( #txt - 1 ))"
ERROR WINDOW.
$ shellcheck myscript
Line 3:
echo "$(( $txt ))"
^-- SC2004: $/${} is unnecessary on arithmetic variables.
$
Here is a longhand input to the bash version on 'sh' and yes I did have this inside my code, and what a RPITA it was too. (This also fails inside the version of bash for OSX 10.7.5; I don't know about current versions as i don't have them.)
Last login: Wed Sep 28 09:36:29 on ttys000
AMIGA:barrywalker~> sh
AMIGA:barrywalker~> txt="1234567890"
AMIGA:barrywalker~> echo "$(( $txt ))"
1234567890
AMIGA:barrywalker~> echo "$(( ${#txt} - 1 ))"
9
AMIGA:barrywalker~> echo "$(( #txt - 1 ))"
sh: bad substitution: no closing `)' in "$(( #txt - 1 ))"
AMIGA:barrywalker~> _
Either "$/${}" is needed or it is not, which is it?
From now on I will be using $ and ${} as I don't want this aggro again...