shell script not running locally shell script not running locally shell shell

shell script not running locally


Your problem is that you're using BSD sed (as comes with Mac OS X) instead of GNU sed (as is typically found on Linux). BSD sed does not support some features of GNU sed, including \+ in basic regexes. You can instead use \{1,\}:

#!/bin/bashstring='internal func add() -> Int'sed -e 's/^.*func \{1,\}//s/ *\->.*$//s/:[^,)]\{1,\}/:/gs/[, ]//g' <<< "$string"

...or switch to extended regex flavour with -E, although this will require the regexes to be written in that syntax. (In this particular case, the required change is to use + instead of \+; \+ means a literal + in extended syntax)