Skip to content

Instantly share code, notes, and snippets.

@parleer
parleer / readarray.sh
Last active January 1, 2021 19:46
readarray for Bash <4.0
# Attempt to support older BASH without mapfile/readarray
if ! type -t readarray >/dev/null; then
# Very minimal readarray implementation using read.
readarray() {
# _exit "readarray function"
local cmd opt t v=MAPFILE
while [ -n "$1" ]; do
case "$1" in
-h|--help) echo "minimal substitute readarray for older bash"; exit; ;;