mercoledì 30 luglio 2008

Chi prompt if proxy

alias whox='who -Hup'
alias whon='who'


Mi piace mettere questo nel .profile se posso. Le opzioni Hup forniscono l'output più utile in assoluto.

root@xxxxx # whox
NAME LINE TIME IDLE PID COMMENTS
root pts/1 lug 30 23:21 . 22957 (10.x.x.x)
sam-fsd . lug 30 05:46 17:41 7917 id= sf
root@xxxxx # whon
root pts/1 lug 30 23:21 (10.x.x.x)

Si può fare riferimento alla pagina man di who per dettagli sulle opzioni coinvolte.

Mi piace anche rifare il prompt definendo:
PS1='\u@\h - \w ->'
E' un pò invasivo quindi rimane nel mio .profile utente.

In genere uso il .profile-EIS di Sun, che è molto comodo, aggiungo quanto sopra, e se ho un portatile un paio di if che mi settano il proxy se sono al lavoro o meno:

IP=`ifconfig ath0|grep inet|awk '{print $2}'|cut -b6-20`
PROXY_NET="192.168."
PROXY_NET2="10.0."
if [[ `echo $IP|grep "$PROXY_NET"` ]]; then
http_proxy="http://pippo:1";
export http_proxy;
else
unset http_proxy;
fi
[ -- CUT -- ]

Questo post è in evoluzione, nuove aggiunte non appena ce ne saranno. Se vuoi contribuire puoi aggiungere un commento.

Nessun commento:

Visite