Home > Enterprise >  How could mapfile hang indefinitely?
How could mapfile hang indefinitely?

Time:01-13

The following bash command:

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

Hang indefinitely, why?

CodePudding user response:

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}"
  •  Tags:  
  • Related