I have a file with the content:

export PATH=$PATH:$HOME/PyModel/bin

When I try to run this file it opens with the text editor. I want to run this file so that the path is appended in my mac os.

Please help!! Thanks in advance.



source filename

should do the trick.


Place the following on the first line of the file:


Rename the file extension to .sh. So if the filename is file.txt now it will be called file.sh

Don't forget to make it executable:

chmod a+x file.sh

And finally, run it with ./:

  • Although this technically is a way to "run this file", you do know that this will do nothing effective, ne? It won't modify the path in the way that the questioner wants. – JdeBP Dec 18 '13 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.