Here I am giving an example of a bash shell script which will determine the script name in Linux using the basename with $0 parameter.
Determine/Get the Script Name in Linux Using Shell Script
The following shell script will determine its name and will assign to a variable at runtime.
get_filename.sh
#!/bin/bash
sname=$(basename $0)
echo
echo "The script name is : $sname"
Make the File Executable
chmod +x get_filename.sh
Test
./get_filename.sh
Output
The script name is : get_filename.sh