# HG changeset patch # User devi # Date 1138999786 -7200 # Node ID 6f5ad37fc8d9e532e67ccba3c6328fdf550be477 # Parent 1e1422588716b47381efefd475af2cdf8b84fa93 Добавлен файл l3bashrc, который настраивает среду интерпретатора и включает запись lilalo-скриптов. Настройка разбита по функциям. ПОКА ЧТО НЕ РАБОТАЕТ! diff -r 1e1422588716 -r 6f5ad37fc8d9 l3bashrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/l3bashrc Fri Feb 03 22:49:46 2006 +0200 @@ -0,0 +1,82 @@ +#!/bin/sh + + +_l3_start() +{ + L3_TTY=`tty` + proc_on_the_term=`w | grep "${L3_TTY##/dev/}" | awk '{print $8;}'` + # freeBSD: + [ -n "$bsd" ] && \ + proc_on_the_term=`w | grep "${L3_TTY##/dev/tty}" | awk '{print $6;}'` + + if [ -n "$proc_on_the_term" ] && echo $proc_on_the_term | grep -qv script + then + _l3_start_session + _l3_run_script + else + _l3_env + _l3_prompt + fi +} + +_l3_env() +{ + true +} + +_l3_prompt() +{ + export PS1='\[` + a="$?"; + HIDDEN=$([ "$a" = 0 ] || echo -n ^"$a")$(echo -n _${UID}_)$(echo -n _$$_)$(date\ + +"%j$(cat ${LMHOME}/lab 2>/dev/null) %H:%M:%S"); + echo $HIDDEN`\033[50D\033[K\][\u@\h:\W]\$ ' +} + +_l3_start_session() +{ + L3_SESSION_ID=${L3_TTY##*/}-$$ + L3_HOME=~/.lilalo/ + mkdir -p $L3_HOME + + uname -a | grep -qi bsd && bsd=yes + parent=`cat /proc/$PPID/cmdline 2> /dev/null` + system=`uname -rs` + login_from=`who | grep "${tty##/dev/}" | awk '{print $6;}' | tr -d '()'` + #[ -n "$bsd" ] && login_from="" #FIXME! + start_time=`date +%s` + hostname=`hostname -f 2> /dev/null` + [ -n "$bsd" ] && hostname=`hostname` + + cat < $L3_HOME/$L3_SESSION_ID.info + + $L3_SESSION_ID + $hostname + $USER + $UID + $login_from + $tty + $system + $parent + $PPID + $$ + $start_time + +INFO + + unset parent system login_from start_time hostname +} + +_l3_run_script() +{ + uname -a | grep -qi bsd && bsd=yes + flush="-f" #linux + [ -n "$bsd" ] && flush="-t 0" #freebsd + exec script $flush -q $L3_HOME/${L3_SESSION_ID}.script +} + +_l3_close_session() +{ + history > $L3_HOME/$L3_SESSION_ID.info +} +