Files
SedPP/scripts/test-pipe-regex-fallback.sh
T

23 lines
616 B
Bash
Executable File

#!/bin/sh
set -eu
sed_bin=$1
# Limine uses this portability probe in gensyms.sh. The first sed must reject
# the unsupported word-boundary character classes without consuming the pipe,
# leaving the input available to the GNU-compatible fallback expression.
actual="$({
printf '%s\n' \
'00000000 l d .text discarded' \
'00000010 g F .text retained'
} | ("$sed_bin" '/[[:<:]]d[[:>:]]/d' 2>/dev/null ||
"$sed_bin" '/\bd\b/d'))"
expected='00000010 g F .text retained'
if [ "$actual" != "$expected" ]; then
printf 'expected: %s\nactual: %s\n' "$expected" "$actual" >&2
exit 1
fi