문제

Im trying executing a python file from an alias (macosx).

It's possible?.

alias execute ='python path/file.py'

Im trying like this, but doesn't work, any suggestion?

Thanks

도움이 되었습니까?

해결책

Remove the space before the =, and it should work:

$ cat /tmp/x.py 
print 'hello, world!'

$ alias execute='python /tmp/x.py'
$ execute
hello, world!

Also note that I'm using the absolute path (/tmp). Using a relative path would make the command work in some directories, but not in others.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top