How could mapfile hang indefinitely?

The following bash command:

mapfile -t "DP_ARGS" "<${ARG_PATH}"

Hang indefinitely, why?


Solution 1:

By quoting "<${ARG_PATH}" you are passing an unused argument to mapfile instead of redirecting. It therefore hangs waiting for you to enter data via keyboard instead.

To redirect, leave < unquoted:

mapfile -t "DP_ARGS" < "${ARG_PATH}"