Automation, Orchestration, and Scripting

A team deploys the same Python 3 script to several servers. On some, python3 is in /usr/bin, and on others it is in /usr/local/bin. Which shebang lets the script run on all of them without editing the file?

Show the answer

Correct answerA. #!/usr/bin/env python3

The env utility sits at a consistent path and finds python3 by searching PATH, so the script works wherever the interpreter is installed. A hard-coded path fails on servers that install python3 elsewhere. The kernel does not expand commands in a shebang, and a bare name is not resolved through PATH.