Bash Completion

Submitted by Swobodin on Fri, 2006-05-12 10:40. ::
Bash completion is a collection of shell functions that take advantage of the programmable completion feature of bash 2.04 and later.
Installation is easy, type as root
and activate it
Once you hit "tab" key, completion is more "intelligent", for example:
For example, to add "SVG" extension to "display", edit /etc/bash_completion and change the line ending with display (Vim search: /^complete.*display$) adding "|SVG" within the entries.
To add extensions to "php" command, append
To disable that feature (I don't see a reason to do it), rename the profile file
Installation is easy, type as root
yum install bash-completion
and activate it
source /etc/bashrc
Once you hit "tab" key, completion is more "intelligent", for example:
- It only displays directory with "cd"
- Only displays image files with "display"
- Displays available manual pages with "man"
- Shows mount points with "mount"
- Shows commandline options for the most useful commands, eg. "rpm", "ls", "perl", "mkisofs", etc.
- Displays possible words of dictionary with "look" command
- Recognizes environment variables, aliases and functions
- Can find commandlines and binaries in path within a script (a loop "for", "while", ...)
For example, to add "SVG" extension to "display", edit /etc/bash_completion and change the line ending with display (Vim search: /^complete.*display$) adding "|SVG" within the entries.
To add extensions to "php" command, append
complete -f -X '!*.@(php|php3|php4|php5|phtml|inc)' php
To disable that feature (I don't see a reason to do it), rename the profile file
mv /etc/profile.d/bash_completion.sh{,.bak}
Recent comments
23 hours 31 min ago
1 week 1 day ago
1 week 5 days ago
2 weeks 1 day ago
3 weeks 3 days ago
3 weeks 4 days ago
6 weeks 2 days ago
7 weeks 2 days ago
7 weeks 4 days ago
8 weeks 1 day ago