用户定义的bash_completion.d脚本的标准位置?

前端之家收集整理的这篇文章主要介绍了用户定义的bash_completion.d脚本的标准位置?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个用户访问(没有root)到 Linux(Suse)机器,我开发了一些bash脚本和相应的bash自动完成规则.

由于脚本只属于我的用户,因此我需要完整的规则对我来说只是“活动”(部分原因是我没有root写入访问权限),将我的bash_completion脚本放入/etc/bash_completion.d/文件夹中不是一种选择.

目前我将我的文件命名为.bash_completion.myscript并直接从我的.bashrc中获取,但我只是想知道是否还有其他“标准”方法来实现这些结果,已经在bash实现中考虑过了.

例如,创建一个文件夹/home/myuser/.bash_completion.d/?

使用〜/ .bash_completion文件.

Bash Completion FAQ

Q. How can I insert my own local completions without having to
reinsert them every time you issue a new release?

A. Put them in ~/.bash_completion,which is parsed at the end of the
main completion script. See also the next question.

Q. I author/maintain package X and would like to maintain my own
completion code for this package. Where should I put it to be sure
that interactive bash shells will find it and source it?

A. Install it in one of the directories pointed to by bash-completion’s pkgconfig file variables. There are two alternatives: the recommended one is ‘completionsdir’ (get it with “pkg-config –variable=completionsdir bash-completion”) from which completions are loaded on demand based on invoked commands’ names,so be sure to name your completion file accordingly,and to include for example symbolic links in case the file provides completions for more than one command. The other one which is present for backwards compatibility reasons is ‘compatdir’ (get it with “pkg-config –variable=compatdir bash-completion”) from which files are loaded when bash_completion is loaded.

原文链接:https://www.f2er.com/bash/386171.html

猜你在找的Bash相关文章