Interview Prep/Linux/Permissions, ownership, SELinux and mounts

A shell script works when run with `bash script.sh` but fails with `sh: 3: [[: not found` from cron.

BeginnerTroubleshootingPermissions, ownership, SELinux and mounts
Answer

Likely causes → Cron or a missing shebang runs it with /bin/sh (dash on Debian/Ubuntu), which doesn't support bash features.

Diagnose →

head -1 script.sh
ls -l /bin/sh

Fix → Add #!/usr/bin/env bash as the first line and call the script directly, or set SHELL=/bin/bash in the crontab.

Prevent → Run shellcheck and always include a shebang.

All Linux questions Roadmap: Linux

More on Permissions, ownership, SELinux and mounts