指定在bash完整的两个文件扩展名 [英] Specifying two file extensions in bash complete

查看:91
本文介绍了指定在bash完整的两个文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修改bash的完整的属性。

我正是如此排除命令文件扩展名:

 完整-f -X*您好'VIM

我要指定排除两个文件名。我该怎么做呢?

注:以下命令不工作

 完整-f -X(*您好| * O)VIM


解决方案

要做到这一点的方法之一是启用的扩展水珠的。在命令行中运行它,或者把它添加到你的.bashrc,使其永久化:

 禁用了javascript -s extglob

现在,您的完整命令是这样的:

 完整-f -X* @(喜| O)。VIM

从引用的扩展水珠模式的:

  @(列表):匹配给定的模式之一。

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.

这篇关于指定在bash完整的两个文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆