1

我正在尝试为我的 svn 源代码控制编写一个别名,它位于/usr/xxx/bin/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
4

1 回答 1

0

这是一个错字。您设置$FULLPATHtrue,但随后您测试是否$FULLENVtrue

此外,与其将环境变量设置为字符串trueor false,不如设置或不设置 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.

于 2013-09-06T22:02:44.443 回答