比如我写好了一个test.py脚本,通常都要这样调用:
$ python3 test.py -h
我想问大家如何实现下面的这样:
$ test -h
alias别名不算哈。
怪我咯2017-04-17 18:02:58
Create a file such as /usr/sbin/test
Test code
#! /usr/bin/python3
print('my test')
Give the file executable permission
chmod +x /usr/sbin/test
In this way, you can directly access the test command in any directory in the console
If your directory is not in $PATH, add it yourself
大家讲道理2017-04-17 18:02:58
You can add alias in .bash_profile or
establish a soft connection in /usr/bin/