我得到了随机的"cd:太多的争论。“当使用不同的命令时,例如newgrp或登录时。下面是一个控制台日志,显示了问题以及Linux版本和shell类型。
Last login: Mon Jun 4 10:50:58 2018 from somewhere.com
cd: Too many arguments.
myServerName /home/myUserName>
myServerName /home/myUserName>
myServerName /home/myUserName>
myServerName /home/myUserName>
myServerName /home/myUserName> groups
groupA groupB
myServerName /home/myUserName> newgrp groupB
cd: Too many arguments.
myServerName /home/myUserName> groups
groupB groupA
myServerName /home/myUserName> uname -or
2.6.32-696.13.2.el6.x86_64 GNU/Linux
myServerName /home/myUserName> lsb_release -irc
Distributor ID: RedHatEnterpriseServer
Release: 6.9
Codename: Santiago
myServerName /home/myUserName> echo $0
tcsh
myServerName /home/myUserName>newgrp命令实际上运行得很好,不过我还是想去掉这条消息。
不幸的是,在线搜索没有真正的结果,因为它们都是关于cd命令本身的。
我欢迎在追踪这一问题方面提供一些帮助。
myServerName /home/myUserName> grep "cd " ~/.tcshrc ~/.cshrc ~/.login
grep: /home/myUserName/.tcshrc: No such file or directory
myServerName /home/myUserName> grep "cd " ~/.cshrc ~/.login
myServerName /home/myUserName>~/..cshrc~/.登录文件:
# ---------------------------------------------------------------------------- |# ----------------------------------------------------------------------------G
# Name : .login |# Name : .cshrc
# Function : users startup-file for csh and tcsh |# Function : Users startup-file for csh and tcsh
# |#
# Note : Please do not edit this file until you have read the |# Note : Please do not edit this file until you have read the
# site policy file for dot-files: /etc/home/README |# site policy file for dot-files: /etc/home/README.*
# |#
# ---------------------------------------------------------------------------- |# ----------------------------------------------------------------------------
if (-r /etc/home/login && -d /env) then |if (-r /etc/home/cshrc && -d /env) then
source /etc/home/login | source /etc/home/cshrc
else |else
source .login.old | source .cshrc.old
endif |endif发布于 2018-06-05 07:09:27
这个问题出现在~/..cshrc~/..login脚本中:
# ----------------------------------------------------------------------------
# Name : .login
# Function : users startup-file for csh and tcsh
#
# Note : Please do not edit this file until you have read the
# site policy file for dot-files: /etc/home/README
#
# ----------------------------------------------------------------------------
if (-r /etc/home/login && -d /env) then
source /etc/home/login
else
source .login.old
endif source命令被一个别名覆盖,该别名是某个目录的快捷方式。删除别名修复了问题。
https://unix.stackexchange.com/questions/447803
复制相似问题