

I hope this article added to your Linux knowledge. The space between #! /bin/bash doesn’t matter. If you are using zsh specific syntax, you can indicate that it is zsh script by adding #! /bin/zsh as the first line of the script. Using #! /bin/bash indicates that the script is bash shell script and should be run with bash as interpreter irrespective of the shell which is being used on the system. In zsh, the array index starts at 1 instead of 0. See, most of the shell syntax is common in all kind of shell but some might differ.įor example, the array behavior is different in bash and zsh shells.

script.sh manner, it is usually run with whatever shell you are running.ĭoes it matter? It could. If you don’t do that and run a script in. When you use the #! /bin/bash, you are specifying that the script is to run with bash as interpreter. Remember how I mentioned that shell is just a program and there are different implementations of shells. Why most shell scripts contain #! /bin/bash at the beginning of the shell scripts? When you specify the script WITHOUT the absolute or relative path, it cannot find it in the directories mentioned in the PATH variable.
