首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获得随机"cd:太多的争论。“使用不同命令时的错误消息

获得随机"cd:太多的争论。“使用不同命令时的错误消息
EN

Unix & Linux用户
提问于 2018-06-04 15:21:51
回答 1查看 2.2K关注 0票数 1

我得到了随机的"cd:太多的争论。“当使用不同的命令时,例如newgrp或登录时。下面是一个控制台日志,显示了问题以及Linux版本和shell类型。

代码语言:javascript
复制
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命令本身的。

我欢迎在追踪这一问题方面提供一些帮助。

更新

代码语言:javascript
复制
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~/.登录文件:

代码语言:javascript
复制
# ----------------------------------------------------------------------------                        |# ----------------------------------------------------------------------------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
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2018-06-05 07:09:27

这个问题出现在~/..cshrc~/..login脚本中:

代码语言:javascript
复制
# ----------------------------------------------------------------------------    
# 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命令被一个别名覆盖,该别名是某个目录的快捷方式。删除别名修复了问题。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/447803

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档