我的csh shell别名不起作用

时间:2013-09-06 18:55:10

标签: csh

我正在尝试为/usr/xxx/bin/svn下的svn源代码控制编写别名。 修改.cshrc目录下的/users/xxx文件后,别名无效。

此处我的.cshrc内容如下所示,

# Should all paths (even NFS, which might hang) be set up at login?
# The alias "fullpath" is available to setup your full path.  It can 
# also be used to change your path by changing USER_PATH above.
setenv FULLPATH true                            # 'true' or 'false'

###########################################################################
# Everything above this line helps configure the environment.

# This line should not be removed.
set dotdir=~/.files; if ( -f $dotdir/sys_cshrc ) source $dotdir/sys_cshrc
if ( $FULLENV != "true" && $?prompt == 0 ) exit

###########################################################################
# Everything below this line is run for interactive shells.
# If you wish the full environment even in non-interactive
# shells set FULLENV above to 'true'.

umask 022                                      # no write by group or other
unset autologout                               # disable autologout
set filec                                      # enable filename completion
set fignore=(.o)                               # don't complete .o files
set history=128                                # save last 128 commands
set ignoreeof                                  # disable ^D for logout
set noclobber                                  # disable redirect overwrite
set notify                                     # enable immediate job notify
set prompt="${HOST}:\!> "                      # shell prompt format
set cdpath = (.. ~)                            # where cd if dir unfound

if ( $?MAIL != 0 ) then
        set mail=( $MAIL )                     # mail spool
endif

##  
# Source other rc files after this line.
if ( -f ~/.cshrc_LOB  ) source ~/.cshrc_LOB
if ( -f ~/.cshrc_BU   ) source ~/.cshrc_BU
if ( -f ~/.cshrc_USER ) source ~/.cshrc_USER

source /auto/andatc/independent/shellrc-files/current/rc/.cshrc.build
set path = ( /usr/bin $path $HOME/usr/bin)
setenv LD_LIBRARY_PATH /auto/nuo-common/swtools/svn/i386/linux/0/lib:$LD_LIBRARY_PATH

setenv ANT_HOME /auto/nbv_proj/share/tools/apache-ant-1.7.1
setenv ANT_OPTS "-Xmx512m -XX:MaxPermSize=256m"
setenv JAVA_HOME /auto/nbv_proj/share/tools/jdk1.6.0_10
setenv SVN_EDITOR /usr/bin/vim

alias svn '/usr/cisco/bin/svn'

当我尝试在我的工作区中使用svn时,我得到以下输出:

$ svn help
svn: Command not found.

$ echo $SHELL
/bin/csh

现在要访问svn,我遵循以下步骤。

1-login to the system and pwd shows o/p :/users/rakmohan
2-then cd /ws/rakmohan-sjc/
3-then /usr/cisco/bin/svn help

1 个答案:

答案 0 :(得分:0)

这是一个错字。您将$FULLPATH设置为true,然后测试$FULLENV是否为true

此外,不是将环境变量设置为字符串truefalse,而是设置或不设置shell变量更方便:

set FULLPATH # or unset FULLPATH
...
if ( ! $?FULLPATH && ! $?prompt) exit

正如twalberg的评论所暗示的那样,将svn添加到您的路径可能更有意义,而不是将/usr/cisco/bin/svn别名化为/usr/cisco/bin/svn。或者,如果该目录中还有其他您不希望显示的命令,则可以在路径中已有的另一个目录中创建符号链接:

ln -s /usr/cisco/bin/svn $HOME/usr/bin/.

你只需要做一次;它不需要.cshrc中的任何额外内容。