获得随机“cd:太多参数。”使用不同命令时的错误消息

获得随机“cd:太多参数。”使用不同命令时的错误消息

我收到随机“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 〜/.login 文件:

# ----------------------------------------------------------------------------                        |# ----------------------------------------------------------------------------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

答案1

问题出在 ~/.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命令被别名覆盖,该别名是某个目录的快捷方式。删除别名解决了该问题。

相关内容