If you run the script as 'bash -vx /path/to/script.sh' you can see all variables filled in etc, etc. Also note there's no need for nesting so:
Code:
if [ "$1" = "A" ]; then
echo 0 > Type.txt
elif [ "$1" = "B" ]; then
echo 1 > Type.txt
elif [ "$1" = "C" ]; then
echo 2 > Type.txt
elif [ "$1" = "D" ]; then
echo 3 > Type.txt
else
echo "Fail"
fi
should do and you could alternatively use a case statement:
Code:
case "$1" in
A) echo 0 > Type.txt;;
B) echo 1 > Type.txt;;
C) echo 2 > Type.txt;;
D) echo 3 > Type.txt;;
*) echo "Fail";;
esac
Code:
function help() { echo "Bash scripting guides:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html
http://www.gnu.org/software/bash/manual/html_node/index.html
http://www.grymoire.com/Unix/Sh.html
http://www.tldp.org/LDP/abs/html/
http://wooledge.org/mywiki/BashFAQ?action=show&redirect=BashFaq
http://wooledge.org/mywiki/BashPitfalls"; }