Is there a way to find the position of the first character in a string in Bash on Mac OS X?
Sort of:
stringZ=abcABC123ABCabc # 6 echo `expr index "$stringZ" C12` # C position.
as described in the Advanced Bash-Scripting Guide
A couple of fixes:
- The official index function
expr index $string $substring not present according to OS X (BSD) - Installing gnu compliance (gmatch) does not seem to be a portable BSD solution
Any ideas?
source share