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?

0

1 Answer 1

0

Source Script

echo $0

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

Soft link

ln -s S.sh script_link
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.