A script can isolate Bash-only features behind a small decision so the portable path remains visible and testable.

Program

Play the script to choose a shell mode and see which list representation the script plans to use.

feature_guard.sh
#!/usr/bin/env bash

shell_mode=
if [ "$shell_mode" = "bash" ]; then
    list_style="array"
else
    list_style="newline-list"
fi
echo "$shell_mode:$list_style"
#!/usr/bin/env bash

shell_mode=
if [ "$shell_mode" = "bash" ]; then
    list_style="array"
else
    list_style="newline-list"
fi
echo "$shell_mode:$list_style"
feature guard A guard keeps a Bash-only choice explicit instead of scattering assumptions through the script.
array boundary Arrays are Bash features; POSIX `sh` scripts often use newline-delimited text instead.
mode label A clear label makes the selected portability path visible in logs and tests.