Search code examples
pythonshellpython-2.7terminalfish

Execute python script while open terminal


I want this: Execute python script while I open terminal (I am using iTerm and fish-shell).


Solution

  • The fish-shell was new to me, so I read the documentation - something I really recommend. Look for the title "Initialisation Files": http://fishshell.com/docs/current/index.html#initialization

    So it looked like you call your python scripts from ~/.config/fish/config.fish

    So I installed fish on my Macbook and I had to create the config.fish file. In that I just placed:

    ~/gash.py
    

    That executes the python program gash.py in my home directory. Of course the #! line has to be correct and I have to have execute permissions (as usual). I entered the fish shell and it executed the program.

    Thanks for that, the fish-shell looks quite interesting. I love stackoverflow.