As tcsh
starts it reads and processes ~/.login
.
(See below for notes on ~, your home directory.)
Typically this code sets variables and chooses shell options.
If you choose bash
, it similarly processes
~/.bashrc
.
Appropriate versions of these files are below for both
the developer platform and the server.
To fix line endings it may be necessary to process them
with
dos2unix
.
Italicized text must be replaced with values appropriate for your system.
.login for developer platform (cygwin on MS Windows)
# If not running interactively,
# the settings below will inherit
if ( $shlvl != 1 ) exit
# essential environment values
# HOME root directory for the user's files
# corresponds to ~
# SRCROOT - directory for the root of
# the page tree visible on the server
# PICTOOLS - location of pictools directory
# often is $SRCROOT/pictools
# JAVAROOT - root of directories for
# Java projects and tools/makesite.php
setenv HOME /cygdrive/U/Fred
setenv SRCROOT $HOME/Physpics/websrc
setenv PICTOOLS $SRCROOT/pictools
setenv JAVAROOT $HOME/Java
# on physpics server:
# HOME=/home/phypics
# SRCROOT=$HOME/physpics.com
# PICTOOLS $SRCROOT/pictools
# JAVAROOT=$SRCROOT/Java
#add pictools to path
setenv PATH "${PICTOOLS}:${PATH}"
### convert Ant file names from Windows to Unix
if ( $?ANT_HOME ) \
setenv ANT_HOME `cygpath --unix $ANT_HOME`
if ( $?M2_HOME ) \
setenv M2_HOME `cygpath --unix $M2_HOME`
if ( $?M2 ) \
setenv M2 `cygpath --unix $M2`
#set some shell options
#tcsh:
set prompt='%c03> '
set autologout=300
set echo_style=bsd
set ellipsis=1
#bash:
#TMOUT=300
#PS1="\w> "
#PROMPT_DIRTRIM=3
#define some handy shortcuts
alias grI 'grep -rI '
# (ls coloring clashes with white-on-blue terminals)
alias ls 'ls --color=never'
alias ll "ls -l "
alias la "ls -a "
# handy code to print readable path
alias showpath 'echo $PATH | tr ":" "\n"'
#SERVER# #### define these on the server
#SERVER# set prompt="SS $prompt"
#SERVER# # view page server logs
#SERVER# alias lac less ~/logs/physpics.com/http/access.log
#SERVER# alias ldb less ~/physpics.com/admin/logs/debug.txt
echo /home/Fred/.login has set wd to $HOME
cd $HOME
.login for web host (Linux)
# If not running interactively,
# the settings below will inherit
if ( $shlvl != 1 ) exit
setenv HOME /home/physpics
setenv SRCROOT $HOME/physpics.com
setenv PICTOOLS $SRCROOT/pictools
setenv JAVAROOT $SRCROOT/Java
#add pictools to path
setenv PATH "${PICTOOLS}:${PATH}"
#set some shell options
set prompt='%c03> '
set autologout=300
set echo_style=bsd
set ellipsis=1
#define some handy shortcuts
alias grI 'grep -rI '
# (ls coloring fails for white-on-blue terminals)
alias ls 'ls --color=never'
alias ll "ls -l "
alias la "ls -a "
# handy code to print readable path
alias showpath 'echo $PATH | tr ":" "\n"'
#### define these on the server
set prompt="SS $prompt"
# view page server logs
alias lac less ~/logs/physpics.com/http/access.log
alias ldb less ~/physpics.com/admin/logs/debug.txt
echo /home/physpics/.login has set wd to $HOME
cd $HOME
alternative code to convert all environment values that
start with Windows filenames: x:\...
This code runs longer than you might think.
printenv | gawk -F = 'BEGIN {a = "\047"} \
1~/^[A-Za-z][A-Za-z0-9_]*$/
&& $2~/^[A-Za-z]:\\/ { line = $0; var = $1;
cmd = "cygpath --unix " a ENVIRON[var] a; \
(cmd|getline); val = $0; close(cmd); \
if (line != (var "=" val)) print \
"setenv " var " " a val a; next} ' \
| source /dev/stdin
.bashrc for developer platform
# If not running interactively,
# the settings below will inherit
[[ "$-" != *i* ]] && return
# essential environment values
# HOME root directory for the user's files
# corresponds to ~
# SRCROOT - directory for the root of
# the page tree visible on the server
# PICTOOLS - location of pictools directory
# often is $SRCROOT/pictools
# JAVAROOT - root of directories for
# Java projects and tools/makesite.php
export HOME=/cygdrive/U/Fred
export SRCROOT=$HOME/Physpics/websrc
export JAVAROOT=$HOME/Java
export PICTOOLS=$SRCROOT/pictools
#add pictools to path
export PATH="${PICTOOLS}:${PATH}"
# for ANT
if [[ -v ANT_HOME ]];
then
export ANT_HOME=$(cygpath --unix $ANT_HOME)
fi
if [[ -v M2_HOME ]];
then
export M2_HOME=$(cygpath --unix $M2_HOME)
fi
if [[ -v M2 ]];
then
export M2=$(cygpath --unix $M2)
fi
#set some shell options
#tcsh:
#set prompt='%c03> '
#set autologout=300
#set echo_style=bsd
#set ellipsis=1
#bash:
TMOUT=300
PS1="\w> "
PROMPT_DIRTRIM=3
# When changing directory small typos can be
# ignored by bash by setting cdspell.
# For example, cd /vr/lgo/apaache
# would find /var/log/apache.
# shopt -s cdspell
#define some handy shortcuts
alias grI='grep -rI '
# (ls coloring clashes with white-on-blue terminals)
alias ls='ls --color=never'
alias ll="ls -l "
alias la="ls -a "
# handy code to print readable path
alias showpath='echo $PATH | tr ":" "\n"'
#SERVER# PS1='SS \w> '
# view page server logs
#SERVER# alias lac="less ~/logs/physpics.com/http/access.log"
#SERVER# alias ldb="less ~/physpics.com/admin/logs/debug.txt"
echo /home/Fred/.bashrc has set wd to $HOME
cd $HOME
.bashrc for web host
# If not running interactively,
# the settings below will inherit
[[ "$-" != *i* ]] && return
export HOME=/home/physpics
export SRCROOT=$HOME/physpics.com
export JAVAROOT=$SRCROOT/Java
export PICTOOLS=$SRCROOT/pictools
#add pictools to path
export PATH="${PICTOOLS}:${PATH}"
# for ANT
if [[ -v ANT_HOME ]];
then
export ANT_HOME=$(cygpath --unix $ANT_HOME)
fi
if [[ -v M2_HOME ]];
then
export M2_HOME=$(cygpath --unix $M2_HOME)
fi
if [[ -v M2 ]];
then
export M2=$(cygpath --unix $M2)
fi
#set some shell options
#tcsh:
#set prompt='%c03> '
#set autologout=300
#set echo_style=bsd
#set ellipsis=1
#bash:
TMOUT=300
PS1="\w> "
PROMPT_DIRTRIM=3
#define some handy shortcuts
alias grI='grep -rI '
alias ls='ls --color=never'
alias ll="ls -l "
alias la="ls -a "
# handy code to print readable path
alias showpath='echo $PATH | tr ":" "\n"'
PS1='SS \w> '
# view page server logs
alias lac="less ~/logs/physpics.com/http/access.log"
alias ldb="less ~/physpics.com/admin/logs/debug.txt"
echo /home/Fred/.bashrc has set wd to $HOME
cd $HOME