很多年前,我做了“哪个CD”,它告诉我“cd:shell内置命令”。
最近,我试了一下,得到了:
/ usr / bin / which:没有cd in([淫秽的长路径我不会在这里重现])
我调查过,发现有人有别名:
> which which
which alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde
/usr/bin/which
一旦我解决了哪个,“哪个CD”再次正常工作。我的问题:
如何使用别名和shell内置函数使“哪个”工作?
我找不到创建“哪个”别名的位置(它不在 / etc / cshrc,〜/ .cshrc等例如)。这发生在哪里,所以我 可以永久地打败/编辑它吗?
> unalias which; which which which: shell built-in command.
> alias foo bar; which foo foo: aliased to bar > which \foo foo: Command not found.
答案 0 :(得分:1)
至少可以将alias which which
添加到〜/ .cshrc:P
:~> alias which /usr/bin/which
:~> which which
/usr/bin/which
:~> which cd
/usr/bin/which: no cd in [...]
:~> alias which which
:~> which which
which: aliased to which
:~> which cd
cd: shell built-in command.
答案 1 :(得分:1)
在Redhat系统上,它看起来像是在/etc/profile.d/which.sh中定义的
尝试使用unariased命令:
/usr/bin/which cd
/usr/bin/which: no cd in (/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
所以我不确定你的内置输出来自哪里。