daemontools-encore icon indicating copy to clipboard operation
daemontools-encore copied to clipboard

Portability fix: Avoid the use of sed -r

Open fumiyas opened this issue 5 years ago • 1 comments

Legacy sed does not support -r option (use extended regular expressions)

fumiyas avatar Jun 28 '19 09:06 fumiyas

Another option: according to GNU sed's manpage, -E is the POSIX-specified and portable synonym for -r. This seems to work for me on a bunch of platforms:

@@ -20,8 +20,8 @@ svpid=$!
 waitok test.sv

 svstat test.sv \
-| sed -r 's, \(.+\),,' \
-| sed -r 's, ([0-9]|1[0-9]) second.+$, ok,'
+| sed -E 's, \(.+\),,' \
+| sed -E 's, ([0-9]|1[0-9]) second.+$, ok,'

schmonz avatar Jan 25 '20 11:01 schmonz