BeginnerPhone
1 min
Bash Shebang & Execute Bit
LinuxScriptingSystem Administration
Advertisement
Interview Question
What does the shebang line do in a script, and what permission is required to run it directly?
Key Points to Cover
- Shebang (e.g., #!/usr/bin/env bash) selects interpreter
- Executable bit (chmod +x) required to run as ./script.sh
- Alternatively: run via interpreter directly (bash script.sh)
Evaluation Rubric
Explains shebang purpose40% weight
Mentions execute permission30% weight
Shows interpreter invocation alternative30% weight
Hints
- 💡env helps locate interpreter on PATH.
Potential Follow-up Questions
- ❓How to pass arguments?
- ❓What about CRLF line endings issues?
Advertisement