Eine Bash Subshell mit Umleitung der Ausgabe in eine Logdatei. Das Script „subshell“ und „t.bashrc” befinden sich beide im Home Verzeichnis im Unterordner “bin”. Das Log Verzeichniss sollte existieren und befindet sich auch im Home Verzeichnis.

SHELL="/bin/bash --rcfile ~/bin/t.bashrc"
SUBSHELL_LOGDIR=~/log

SubShell() {
  [ ! -e $SUBSHELL_LOGDIR ] && mkdir -p $SUBSHELL_LOGDIR
  BASHLOG=$SUBSHELL_LOGDIR/$(date '+%Y%m%d_%H%m%S')-$$.log
  clear
  echo "All Output from Shell will send to: $BASHLOG"
  echo $(date) >>$BASHLOG
  (
    # bash: no job control in this shell
    exec 1> >(tee -a $BASHLOG) 2>&1
    # /bin/bash -il
    /bin/bash --rcfile ~/bin/t.bashrc -i
  )
  echo "$(date '+%Y%m%d_%H%m%S') Session Closed." >>$BASHLOG
}



# open Subshell ...
SubShell
alias l='ls -alF --color=auto'
alias la='ls -la --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias ls-l='ls -l --color=auto'

PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '