Skip to content

Commit e1f4229

Browse files
committed
fix _CP() by switching to ERE for osx sed
-E turns on Extended Regular Expressions, which is alias to -r in GNU sed.
1 parent 3f2b3cd commit e1f4229

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/test_helper.bash

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ PIPESSH="$BATS_TEST_DIRNAME/../pipes.sh"
2727
# nested pairs.
2828
_CP() {
2929
< "$PIPESSH" \
30-
sed -ne '/^\s*# +_CP_\w\+$/,/^\s*# -_CP_\w\+$/ {
31-
s/^\s*# +\(_CP_\w\+\)$/\1()\{/
32-
s/^\s*# -_CP_\w\+$/\}/
33-
p
34-
}' |
35-
sed -e 's/\$\?RANDOM/$((_RND_SEQ[_RND_IDX++]))/g'
30+
sed -n -E \
31+
-e '/^ *# \+_CP_[a-zA-Z0-9_]+$/,/^ *# -_CP_[a-zA-Z0-9_]+$/ {' \
32+
-e 's/^ *# \+(_CP_[a-zA-Z0-9_]+)$/\1()\{/' \
33+
-e 's/^ *# -_CP_[a-zA-Z0-9_]+$/\}/' \
34+
-e 'p' \
35+
-e '}' |
36+
sed -E -e 's/\$?RANDOM/$((_RND_SEQ[_RND_IDX\+\+]))/g'
3637
}
3738

3839

0 commit comments

Comments
 (0)