Suppose a script file named do.sh is executable and the symbolic link named undo.sh points
to it. From within the script, how could you identify if the calling filename was do.sh or undo.sh?
In a system with a properly configured email service, the command mail -s “Maintenance Error” root <<<“Scheduled task error” sends the notice email message to the root user.
Such a command could be used in unattended tasks, like cronjobs, to inform the system
administrator about an unexpected issue. Write an if construct that will execute the
aforementioned mail command if the exit status of the previous command — whatever it
was — is unsuccessful.
You probably misunderstood the question. do.sh already exists, undo.sh is a symlink to it. The question is, how can one determine which file was used for calling the script from inside that script.