2

How to find out whether a shell script is written in bash or sh

view story
linux-howto

http://unix.stackexchange.com – How can I find out whether a script is written in bash or sh? The first line of the script is not helpful here, since on Linux, bash scripts have this line: #!bin/sh Actually, there are many distribution where bin/sh is bash (maybe bin/sh is a link to bin/bash in those distributions), and not Bourne Shell. So if I try to run a script that is written in bash in, for example, FreeBSD, the result is not defined, since bin/sh in FreeBSD is Bourne Shell, and not bash. Is there are easy way to identify if a script is bash or sh? Are there some distinctive things in syntax? (HowTos)