Languages

Linux bash correct first line header

9 points
Asked by:
martineau
1350

What is the correct first line when I create bash script?

1 answer
10 points
Answered by:
Root-ssh
178180

As I suppose that you are asking about first line of the script.

People uses bash and sh as substitutes but they are not the same.

Writing script it is necessary to set first line to indicates script interpreter.

Depending what interpreter you whould like to use we can select Bourne shell, Bash shell or something other (python, php, perl, lua, ...).

Using Bourne shell first line should be:

Using Bash shell first line should be:

Summary: bash is like improvement for sh.

Do not forget to add permissions to execute your script:

See also:

  1. Bash correct header #!/bin/sh - create simple bin sh shell script with .sh code example

Resources

  1. https://en.wikipedia.org/wiki/Bash_(Unix_shell)
  2. https://en.wikipedia.org/wiki/Bourne_shell
0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join