歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> SHELL編程

shell編程例子 -- 一個.cshrc例子

  ***************************************************************** # * * # * * # ***************************************************************** # # HISTORY # # @(#)$RCSfile: .cshrc,v $ $Revision: 4.1.3.3 $ (DEC) $Date: 1992/05/11 09:13:09 $ # setenv MAIL /usr/spool/mail/$USER #*************************************************************** #*************************************************************** # # add by zzy 2000.08.06 # #*************************************************************** #*************************************************************** # set pics environment #*************************************************************** #source /etc/pics.d/picsenv.csh #*************************************************************** # set innovator environment #*************************************************************** #source /usr/innovator/inoenv.csh #*************************************************************** # set PCFC application environment #*************************************************************** source ${HOME}/app_login #*************************************************************** # change path to home path #*************************************************************** cd ${HOME} #*************************************************************** app_login: ========== #*************************************************************** #* module: app_login #* description: app login #* This script must be called in the login file #* with the command 'source app_login' #* author: zzy #* version: 31.08.1998 #*************************************************************** #*************************************************************** # entry #*************************************************************** #*************************************************************** # environment #*************************************************************** set say = "echo" set mode = "" set node = "`uname -n`" set user = "`logname`" #*************************************************************** # this path and this script #*************************************************************** set this_path1 = "`dirname ${HOME}/x`" set this_script1 = "app_login" if ( ! -f ${this_path1}/${this_script1} ) then $say 'this script must be in the Directory $HOME'


goto exit endif #*************************************************************** # start message #*************************************************************** $say " %$this_script1, `date '+%H:%M:%S'` start executing on $node" #*************************************************************** # set project and channel prefix for all user #*************************************************************** if ( "$user" == "root" ) then setenv PROJ pcfc setenv CPRE "" endif if ( "$user" == "pcfc" ) then setenv PROJ pcfc setenv CPRE "" endif if ( "$user" == "picsadm" ) then setenv PROJ baoshan setenv CPRE "" endif if ( "$user" == "picsvis" ) then setenv PROJ baoshan setenv CPRE "" endif if ( "$user" == "" ) then setenv PROJ pcfc setenv CPRE "" endif #*************************************************************** # set project directory #*************************************************************** setenv PROJ_DIR /home/$PROJ #*************************************************************** # call project application login #*************************************************************** if ( -f "${this_path1}/${this_script1}_$PROJ" ) then $say " %$this_script1, call project application login" source ${this_path1}/${this_script1}_$PROJ endif #*************************************************************** # end message #*************************************************************** #$say " %$this_script1, `date '+%H:%M:%S'` finished" #*************************************************************** # exit #*************************************************************** exit: unset this_path1 unset this_script1 exit #*************************************************************** app_login_pcfc ============== #*************************************************************** #* module: application_login_$PROJ #* description: application login for a project #* This script must be called in the login file app_login #* with the command 'source app_login_$PROJ' #* author: Zhou zeyan #* #* version: 8.1.2000 #*************************************************************** #*************************************************************** # entry #***************************************************************

#*************************************************************** # environment #*************************************************************** set say = "echo" set mode = "" set node = "`uname -n`" set user = "`logname`" #*************************************************************** # this path and this script #*************************************************************** set this_path2 = "`dirname ${HOME}/x`" set this_script2 = "app_login_$PROJ" #*************************************************************** # start message #*************************************************************** $say " %$this_script2, `date '+%H:%M:%S'` start executing on $node" #*************************************************************** # history #*************************************************************** set history=40 alias h history #*************************************************************** # aliases #*************************************************************** alias sql sqlplus pcfcadm/pcfcadm #*************************************************************** # set environment for components #*************************************************************** set cmp = glb if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = utl if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = com if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = log if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = tel if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = mva if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then



set cmp = glb if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = utl if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = com if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = log if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = tel if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = mva if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then



endif set cmp = tel if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then source ${PROJ_DIR}/${cmp}/etc/${cmp}_init endif set cmp = mva if ( -r "${PROJ_DIR}/${cmp}/etc/${cmp}_init" ) then



Copyright © Linux教程網 All Rights Reserved