Fix and support sh (not bash) script standard.

* sh is not support $() syntax. replacing to ``.
* `set -e` is good practice on shell scripting.
* shell function have to be defined before using it.
Merge pull request #2 from xtetsuji/fix-sh-syntax

Fix and support sh (not bash) script standard.