What does the shebang line do?
BeginnerConceptPackages, Shell & Text Tools
Answer
#!/path/to/interpreter on the first line tells the kernel which interpreter to run the script with. #!/usr/bin/env bash finds bash in $PATH, which is more portable than #!/bin/bash. A script with #!/bin/sh runs in dash on Debian/Ubuntu, so bashisms like [[ ]] or arrays fail. Windows line endings cause /bin/bash^M: bad interpreter.
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateHow are repositories and their GPG keys configured?AdvancedWhat is the difference between a login shell and an interactive non-login shell?Intermediate