Set the shell for cron
Cron runs jobs with /bin/sh. Set SHELL=/bin/bash at the top of the crontab to use Bash features such as [[ ]], arrays and process substitution.
A command with a Bash feature, like a [[ ]] test, works in a terminal and silently fails under cron.
cat > default.cron <<'EOF'
* * * * * [[ -n "$BASH_VERSION" ]] && echo bash > /tmp/default.txt || echo sh > /tmp/default.txt
EOF
cat > bash.cron <<'EOF'
SHELL=/bin/bash
* * * * * [[ -n "$BASH_VERSION" ]] && echo bash > /tmp/bash.txt || echo sh > /tmp/bash.txt
EOF
useradd -m alice; useradd -m bob
crontab -u alice default.cron
crontab -u bob bash.cron
sleep 65
cat /tmp/default.txt /tmp/bash.txtsh
bashEach job line is passed to the shell named by the SHELL variable, and the default is /bin/sh, which is dash on Debian, so [ is a syntax error and the || branch ran. The [crontab manual lists SHELL among the variables a crontab may set. With SHELL=/bin/bash the same test passes for the second user.
Setting the shell affects only the command string in the crontab, not any script it runs, which follows its own shebang line. Many scripts are better made to work under sh than served by a changed cron environment. The command also runs from the home directory, not the directory of the crontab.