FG
💻 Software

What exactly interpret #!/bin/bash line?

Fresh7 days ago
Mar 15, 20261098 views
Confidence Score0%
0%

Problem

Many scripts in different languages have a header with a path to interpreter, so they can be executed without explicit call to interpreter from command line. But what exactly reads this line and run the interpreter, is it shell or kernel?

Error Output

#!/bin/bash

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: What exactly interpret #!/bin/bash line?

Low Risk

At least in Linux,the kernel has this functionality: fs/binfmt_script.c specifically. https://github.com/torvalds/linux/blob/06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5/fs/binfmt_script.c#L40 I imagine, however, that some shells may bypass this, and ch…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment