## ~/.profile, this file, is read by sh, bash, and ksh ## ## bash reads first of, in order, ~/.bash_profile, ~/.bash_login, ## ~/.profile; so it pays to have separte file for bash. that ## leaves ksh93 & sh to use this file ## # set $HOME #HOME= # bourne again shell (2: 2.04.0(1)-release) #sh=bash"${BASH_VERSION}" # # kornshell (1993: Version M 1993-12-28 m) #sh=ksh"${.sh.version}" set -x -v # set full path if test "${0}" = "${0##*/}" then shells=$(/usr/bin/which -a $0) for sh in $shells do #echo "SH testing $sh ..." if test -x $sh then echo "SH shell is set to $sh ..." break fi done else sh=$0 fi # shell id message sh_id() { echo case $1 in ksh*|bash*) echo "SH running ${1}:" $0 '...' ;; *) echo ' only basic bourne shell settings...' ;; esac echo } # minimal settings (plain sh) bourne_sh() { PS1="$ " export PS1 exist_run env "${HOME}/cf/sh/shopt.cf" exist_run source "${HOME}/cf/sh/alias.cf" } # source or export ENV if file exists exist_run() { if test ! -f "$2" then echo "* $2 is not a file, not sourced/ENV exported" return 1 fi case $1 in source) . "$2" return 0 ;; env* | ENV*) ENV="$2" ; export ENV return 0 ;; *) echo '* please pass either "source" or "env" as the 1st arg' return 1 ;; esac } # set environment exist_run source "${HOME}/cf/sh/env.cf" case ${0##*/} in ksh* | -ksh*) #typeset -f exist_run bourne_sh sh_id sh_id ksh exist_run env "${HOME}/cf/sh/ksh.cf" exist_run source "${HOME}/bin/init-run" #exist_run source "${HOME}/cf/sh/function.ksh" exec $sh #$sh ;; bash | -bash) sh_id bash exist_run source "${HOME}/.bash_profile" ;; *) sh_id sh bourne_sh ;; esac