问题描述
是否有可能添加到Bash使用了波浪线扩展规则?我想有〜数据扩展到/数据/用户/我,从头〜扩展到/数据/刮/我等。这是可能的,或者确实有bash的太紧一个紧握的'〜'?
Is it possible to add to the rules that bash uses for tilde expansion? I'd like to have ~data expand to /data/users/me, ~scratch expand to /data/scratch/me etc.. Is this possible, or does bash have too tight a tight hold on the '~'?
谢谢,
安德鲁
推荐答案
波浪线扩展被绑定到用户的主目录(或目录栈的内容或 $ PWD
或 $ OLDPWD
)。使用变量扩展,别名或函数来完成你以后。您还可以使用 CDPATH
来列出一组目录为 CD
中查找目标目录。
Tilde expansion is tied to users' home directories (or the contents of the directory stack or $PWD
or $OLDPWD
). Use variable expansion, aliases or functions to accomplish what you're after. You can also use CDPATH
to list a set of directories for cd
to look in for destination directories.
这篇关于Bash的波浪线扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!