0

So I have a symbolic link called "script_link" and another called "script_link2" and they are both pointing to a bash script (this is hypothetical, I could have a lot more than 2 links to the script). In my script, how can I get the name of the link that called the script? So if I type "./script_link" in the shell, I want my script to echo "script_link" and if I type "./script_link2", I want it to echo "script_link2". Is there anyway to do this in bash?

1 Answers1

0

Source Script

echo $0

case "$0" in
"script_link")
    .....
    ;;
"script_link2")
    .....

Soft link

ln -s S.sh script_link
Vin
  • 97
  • 4