Sime makelike wrapper scripts support

Hadrien Lacour hadrien.lacour at posteo.net
Mon Jan 13 17:53:16 UTC 2020


Just do it in sh. Something like this:

hadrien at gentoo-zen2700x> cat test.in
hello:
        echo hello

world:
        echo world

compound:
        echo foo
        echo bar
hadrien at gentoo-zen2700x> awk '/^hello:/ {flag = 1; next}; flag && /^$/ {exit}; flag {sub("^[[:blank:]]*", ""); print}' test.in | sh
hello
hadrien at gentoo-zen2700x> awk '/^compound:/ {flag = 1; next}; flag && /^$/ {exit}; flag {sub("^[[:blank:]]*", ""); print}' test.in | sh
foo
bar


Just escape the pattern to be safe:
hadrien at gentoo-zen2700x> awk -vpat=$(printf '%s' compound | sed 's#[()|{}+?[^$*.\\-]#\\&#g') 'match($0, "^" pat ":") {flag = 1; next}; flag && /^$/ {exit}; flag {sub("^[[:blank:]]*", ""); print}' test.in | sh
foo
bar


No need to bloat busybox for such thing.


More information about the busybox mailing list