Search code examples
pythonbashbin

Make executable symbolic link in Python?


I have a file called client.py. I created a symbolic link called incro using

ln -s client.py incro

How do I make this script executable and move it to my bin (I'm on Linux using Ubuntu, with a bash terminal), under the name of incro? So that I will be able to run

incro

I have the proper sha-bang. What else do I need to do?


Solution

  • Put the link in your bin directory, not the current directory:

    ln -s $PWD/client.py ~/bin/incro
    

    You should also have ~/bin in your $PATH so that you can run programs that are in there.

    And if the script isn't already executable, add that:

    chmod +x client.py