Live manual

Live Systems

<< previous toc next >>

Manuale di Live Systems

Lo stile nello scrivere codice

15. Lo stile nello scrivere codice

This chapter documents the coding style used in live systems.

15.1 Compatibilità

Assicurarsi che tutto il codice giri con 'set -e'.

15.2 Rientri

15.3 Ritorno a capo

Sbagliato:

if foo; then
         bar
fi

Corretto:

if foo
then
         bar
fi

Sbagliato:

Foo () {
         bar
}

Corretto:

Foo ()
{
         bar
}

15.4 Variabili

Sbagliato:

FOO=bar

Corretto:

FOO="bar"

Sbagliato:

if [ -f "${FOO}"/foo/"${BAR}"/bar ]
then
         foobar
fi

Corretto:

if [ -f "${FOO}/foo/${BAR}/bar" ]
then
         foobar
fi

15.5 Varie


<< previous toc next >>