python tab実装
小さな方法で、ここで共有してみましょう.
[root@web-02 dist-packages]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits"or "license"for more information.
>>> import tab
>>> exit()
[root@web-02 dist-packages]#tail-n 1/etc/profile//ファイルパス、source下
export PYTHONSTARTUP=/usr/lib/python2.7/dist-packages/tab.py
[root@web-02 dist-packages]# cat tab.py
[root@web-02 dist-packages]#
[root@web-02 dist-packages]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits"or "license"for more information.
>>> import tab
>>> exit()
[root@web-02 dist-packages]#tail-n 1/etc/profile//ファイルパス、source下
export PYTHONSTARTUP=/usr/lib/python2.7/dist-packages/tab.py
[root@web-02 dist-packages]# cat tab.py
#!/usr/bin/python
# python startup file
import sys
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab: complete')
# history file
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter
[root@web-02 dist-packages]#