小编Sar*_*nes的帖子

防止带有 FS 路径值的环境变量的 bash 选项卡完成删除环境变量名称

朋友们,

我在 Linux 上使用 GNU bash 作为我的 shell:

$ bash --version
GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ 
Run Code Online (Sandbox Code Playgroud)

当我设置一个以 FS 路径作为其值的环境变量时,它的行为非常奇怪。

假设我想将 /opt/database/bin 添加到 PATH 的前面。

我首先输入:

$ export PATH=/o
Run Code Online (Sandbox Code Playgroud)

然后我按下键盘上的 Tab 键。

但是它没有完成 /opt 的路径,而是删除了 PATH= 部分!相反,我得到:

$ export /opt/
Run Code Online (Sandbox Code Playgroud)

当然,那对我来说非常无用,而且非常恼人!然后我需要手动添加环境变量名称,这根本不是我想要做的!

我希望它完成它: …

bash command-line-interface environment-variables path

5
推荐指数
1
解决办法
837
查看次数