#!/usr/bin/env
searches PATH
for bash
, and bash
is not always in /bin
, particularly on non-Linux systems. For example, on my OpenBSD system, it's in /usr/local/bin
, since it was installed as an optional package.
If you are absolutely sure bash
is in /bin
and will always be, there's no harm in putting it directly in your shebang—but I'd recommend against it because scripts and programs all have lives beyond what we initially believe they will have.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…