I am trying to modify bash complete properties.
I can exclude a file extension for a command thusly:
complete -f -X '*hi' vim
I want to specify two file names for exclusion. How do I do this?
Note: the following command did not work.
complete -f -X '(*hi|*o)' vim
One way to do this is to turn on Extended Globs . Run this at the command line, or add it to your .bashrc to make it permanent:
shopt -s extglob
Now, your complete command can look like this:
complete -f -X '*.@(hi|o)' vim
Quoting from Extended Globs in patterns :
@(list): Matches one of the given patterns.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.