Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have gone through the following steps.

  1. Made the file executable,
  2. Tested that the file could be run with ./script1.py,
  3. Added the file's directory to the system $PATH.

However, at this point, am I supposed to be able to say script1 arg1 and be able to run it like a built-in bash command or do I still need to set up an alias.

My quick hack is to set up an alias; however, I am not sure if this is redundant.

alias script1 = $HOME/dir/script1.py
share|improve this question
is Python in the path ? – karthikr 21 hours ago
Yes it is in the path :) – user1431282 21 hours ago
At this point you are supposed to be able to say script1.py arg1. – delnan 21 hours ago
There is a reason why you should not include . in your path: security. this very reason applies for your question too. – Elazar 21 hours ago
@mbratch If he didn't, he would not be able to run it with ./ in the first place. – Elazar 21 hours ago

1 Answer

up vote 1 down vote accepted
mv script1.py script1

should do the trick. I won't recommend it though.

A better way is to add a symblic link:

ln -s script1.py script1

This way, you can add the link directly in some system path - probably /usr/bin - and won't need to change $PATH at all:

sudo ln -s script1.py /usr/bin/script1

Make sure it will not override any existing file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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