11.04.2013 Views

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

Guida avanzata di scripting Bash - Portale Posta DMI

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appen<strong>di</strong>ce K. Un esempio <strong>di</strong> file .bashrc<br />

Il file ~/.bashrc determina il comportamento delle shell interattive. Un attento esame <strong>di</strong> questo file<br />

porta ad una migliore comprensione <strong>di</strong> <strong>Bash</strong>.<br />

Emmanuel Rouat (mailto:emmanuel.rouat@wanadoo.fr) ha fornito il seguente, e molto elaborato, file<br />

.bashrc, scritto per un sistema Linux. Egli gra<strong>di</strong>rebbe, anche, commenti ed opinioni da parte dei lettori.<br />

Lo si stu<strong>di</strong> attentamente, sapendo che si è liberi <strong>di</strong> riutilizzarne frammenti <strong>di</strong> co<strong>di</strong>ce e funzioni nei propri<br />

file .bashrc o anche negli script.<br />

Esempio K-1. Esempio <strong>di</strong> file .bashrc<br />

#===============================================================<br />

#<br />

# PERSONAL $HOME/.bashrc FILE for bash-2.05a (or later)<br />

#<br />

# Last mo<strong>di</strong>fied: Tue Apr 15 20:32:34 CEST 2003<br />

#<br />

# This file is read (normally) by interactive shells only.<br />

# Here is the place to define your aliases, functions and<br />

# other interactive features like your prompt.<br />

#<br />

# This file was designed (originally) for Solaris but based<br />

# on Redhat’s default .bashrc file<br />

# --> Mo<strong>di</strong>ficato per Linux.<br />

# The majority of the code you’ll find here is based on code found<br />

# on Usenet (or internet).<br />

# This bashrc file is a bit overcrowded - remember it is just<br />

# just an example. Tailor it to your needs<br />

#<br />

#<br />

#===============================================================<br />

# --> Commenti aggiunti dall’autore del HOWTO.<br />

# --> E ulteriormente elaborati da ER :-)<br />

#-----------------------------------<br />

# Source global definitions (if any)<br />

#-----------------------------------<br />

if [ -f /etc/bashrc ]; then<br />

. /etc/bashrc # --> Read /etc/bashrc, if present.<br />

fi<br />

#-------------------------------------------------------------<br />

# Automatic setting of $DISPLAY (if not set already)<br />

# This works for linux - your mileage may vary....<br />

# The problem is that <strong>di</strong>fferent types of terminals give<br />

793

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!