what is the meaning of "script_name=$(basename $0)", can someone please explain?
$0
will expand to the name of the script, as called from the command line.
# cat myscript.shell
echo $0
# ./myscript.shell
./myscript.shell
basename - strip directory and suffix from filenames.
# basename /home/bipinajith/myscript.shell
myscript.shell