Bash shell scripting basic question regarding the syntax

view story

http://www.linuxquestions.org – Consider the script below: myname=`basename $0`; for i in `ls -A` do if [ $i = $myname ] then echo "Sorry i won't rename myself" else newname=`echo $i |tr a-z A-Z` mv $i $newname fi done 1) I am aware that basename $0 signifies my script name here. But how? the syntax explanation please. What does $0 mean? 2) In what cases ";" is used at the end of statement in a script? For example, the first line of script ends with ; , whereas the 8th line doesn't. Also, i found that adding/removing semi-colons at the end of some lines (for example: 1st/6th/8th lines) doesn' (HowTos)