Shebang/Hashbang #! in shell

In unix sh file, we usually see the first line start with #!.

Like #!/bin/bash

The shebang (#!) at the start means execute the script with what follows.

In nodejs script, we usually see

#!/bin/env node

So this means the env command will try to find where the node has been installed from the $PATH, so that we do not have to specify the exact node path which would affect portability.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s