Shebang Linux Term

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/shebang-linux-term/
PINTEREST
PINTEREST
INSTAGRAM

In computing shebang is characters consist of number sign and exclamation mark #! . There is alternative names like she-bang, hash-bang, pound-bang or hash-pling

Shebang is generally used in script like text to specify script interpreter or type.  Some languages omit # as comment mark but with ! there is special meaning.

Syntax

Shebang is generally used with interpreter specification only and no optional argument is provided.

Here interpreter is the application used to interpret following script. Most popular interpreters are Shell, Bash, Python, Perl, Php etc.

Bash is interpreter of the script. echo “poftut.com” will be interpreted as bash script and will print “poftut.com” to the default output.

Providing Parameters

As we see in syntax section parameters can be provided to the specified interpreter. For example it can be provided -x to enable debug in bash scripts like below.

Providing parameters to hashbang

Portability

Some operating system families process shebang differently. To make things more portable env technique can be used. This is useful if specified interpreter path is different in different operating systems. Directly the path defined in environment variable will be called.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/shebang-linux-term/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Bash For and While Loop Examples

Leave a Reply

Your email address will not be published.