I have the following code in my script:
mapfile results < <(mysql --batch -u $DB_USERNAME -p$DB_PASSWORD $DB_DATABASE < query.sql)
and it works fine if running from command line. But if running from /var/spool/cron/root then $results variable contains nothing.
Why and how to fix?