basename is used to get the name of the file given its complete path including the file.
It is also helpful to access the name of a script within it.
To get the name of a file from its complete path.
/home/gj876$ echo $CGI_PATH
/home/gj876$ basename $CGI_PATH
Suppose a script “/home/scripts/linkfiles.sh” is called from another script with its complete path,then to access the base filename of “/home/scripts/linkfiles.sh”, use
the output will be linkfiles.sh