Skip to content

Commit

Permalink
provide an alternative to mapfile for older bash
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Oct 19, 2023
1 parent 1b62827 commit c4770f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions utils/subfiling_vfd/h5fuse.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,15 @@ if test -z "$subfile_dir"; then
exit $FAILED
fi

# For bash 4.4+
subfs=$(sed -e '1,/subfile_dir=/d' "$file_config")
mapfile -t subfiles <<< "$subfs"
if command -v mapfile > /dev/null; then
# For bash 4.4+
mapfile -t subfiles <<< "$subfs"
else
while IFS= read -r line; do
subfiles+=("$line")
done <<< "$subfs"
fi
if [ ${#subfiles[@]} -eq 0 ]; then
echo -e "$RED failed to find subfiles list in $file_config $NC"
exit $FAILED
Expand Down

0 comments on commit c4770f0

Please sign in to comment.