I just encountered a rather interesting issue while doing some shell scripting under Mac OS X 10.6 Snow Leopard. While this code perfectly runs:
#!/bin/sh
function foo {
echo "blabla"
}
foo
It won’t under linux
/path/foo.sh: 3: function: not found blabla /path/foo.sh: 5: Syntax error: "}" unexpected
The solution is to change “#!/bin/sh” to “#!/bin/bash”. And then it works under both systems.
