/usr/share/doc/live-manual/html/coding-style.it.html is in live-manual-html 1:3.0~a9-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
coding-style -
Manuale di Debian Live
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="dc.title" content="Manuale di Debian Live" />
<meta name="dc.author" content="Debian Live Project <debian-live@lists.debian.org>" />
<meta name="dc.publisher" content="Debian Live Project <debian-live@lists.debian.org>" />
<meta name="dc.date" content="2011-12-04" />
<meta name="dc.rights" content="Copyright (C) 2006-2011 Debian Live Project;<br> License: Questo programma è software libero: è possibile ridistribuirlo e modificarlo secondo i termini della GNU General Public License come pubblicata dalla Free Software Foundation, sia la versione 3 della licenza o (a scelta) una versione successiva.<br><br>Questo programma è distribuito nella speranza che possa essere utile, ma SENZA ALCUNA GARANZIA, nemmeno la garanzia implicita di COMMERCIABILITÀ o IDONEITÀ PER UN PARTICOLARE SCOPO. Vedere la GNU General Public License per ulteriori dettagli.<br><br>Si dovrebbe aver ricevuto una copia della GNU General Public License con questo programma. In caso contrario, vedere http://www.gnu.org/licenses/. <br><br>Il testo completo della GNU General Public License può essere trovato nel file /usr/share/common-licenses/GPL-3." />
<meta name="generator" content="SiSU 3.1.9 of 2011w51/1 (2011-12-19) (n*x and Ruby!)" />
<link rel="generator" href="http://www.sisudoc.org/" />
<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
<link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
<a name="top" id="top"></a>
<a name="up" id="up"></a>
<a name="start" id="start"></a><table summary="segment navigation band with banner" bgcolor="#ffffff" width="100%"><tr>
<td width="20%" align="left">
<table summary="band" border="0" cellpadding="3" cellspacing="0"><tr><td align="left" bgcolor="#ffffff"><a href="http://live.debian.net/" target="_top"><img border="0" src="../_sisu/image/debian_home.png" alt="Debian -->" /></a></td></tr>
</table>
</td>
<td width="75%" align="center">
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="#ffffff">
<td align="center" bgcolor="#ffffff">
<a href="sisu_manifest.it.html" target="_top" >
<font face="verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman" size="2">
[ document manifest ]
</font>
</a>
</td>
</tr></table>
</td>
<td width="5%" align="right">
<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="#ffffff">
<a href="bugs.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_prev_red.png" alt="<< previous" />
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="toc.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_up_red.png" alt="TOC" />
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="procedures.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_next_red.png" alt="next >>" />
</a>
</td>
<td>
</td></tr>
</table>
</td></tr>
</table>
<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#eeeeee align="center">
<tr><td align="left">
<a href="bugs.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt="<" />
</a>
</td>
<td align="center">
<a href="toc.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt="^" />
</a>
</td>
<td align="right">
<a href="procedures.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt=">" />
</a>
</td></tr>
</table><div class="content">
<h1 class="tiny">
Manuale di Debian Live
</h1>
</div><div class="content">
<h2 class="tiny">
Progetto
</h2>
</div><div class="content"><div class="substance">
<label class="ocn"><a name="624" href="#624" class="lnkocn">624</a></label>
<h1 class="norm" id="o624"><a name="624"></a>
14. Lo stile nello scrivere codice
</h1>
</div><div class="substance">
<label class="ocn"><a name="625" href="#625" class="lnkocn">625</a></label>
<p class="i0" id="o625">
Questo capitolo documenta lo stile usato per il codice di <i>live-boot</i> e gli altri.
</p>
</div><div class="substance">
<label class="ocn"><a name="626" href="#626" class="lnkocn">626</a></label>
<p class="bold" id="o626"><a name="626"></a> <a name="h14.1" id="h14.1"></a>
<a name="14.1" ></a><a name="h14.1" ></a>14.1 Compatibilità
</p>
</div><div class="substance">
<label class="ocn"><a name="627" href="#627" class="lnkocn">627</a></label>
<li class="bullet" id="o627">
Non usare sintassi o semantiche mirate alla shell Bash. Ad esempio, l'uso di costrutti array.
</li>
</div><div class="substance">
<label class="ocn"><a name="628" href="#628" class="lnkocn">628</a></label>
<li class="bullet" id="o628">
Utilizzare solo il sottoinsieme POSIX - ad esempio, usare $(foo) invece di `foo`.
</li>
</div><div class="substance">
<label class="ocn"><a name="629" href="#629" class="lnkocn">629</a></label>
<li class="bullet" id="o629">
È possibile verificare i propri script con "sh -n" e "checkbashisms".
</li>
</div><div class="substance">
<label class="ocn"><a name="630" href="#630" class="lnkocn">630</a></label>
<p class="bold" id="o630"><a name="630"></a> <a name="h14.2" id="h14.2"></a>
<a name="14.2" ></a><a name="h14.2" ></a>14.2 Rientri
</p>
</div><div class="substance">
<label class="ocn"><a name="631" href="#631" class="lnkocn">631</a></label>
<li class="bullet" id="o631">
Usare sempre i tab piuttosto che gli spazi.
</li>
</div><div class="substance">
<label class="ocn"><a name="632" href="#632" class="lnkocn">632</a></label>
<p class="bold" id="o632"><a name="632"></a> <a name="h14.3" id="h14.3"></a>
<a name="14.3" ></a><a name="h14.3" ></a>14.3 Ritorno a capo
</p>
</div><div class="substance">
<label class="ocn"><a name="633" href="#633" class="lnkocn">633</a></label>
<li class="bullet" id="o633">
Generalmente le righe sono composte da un massimo di 80 caratteri.
</li>
</div><div class="substance">
<label class="ocn"><a name="634" href="#634" class="lnkocn">634</a></label>
<li class="bullet" id="o634">
Utilizzare lo "stile Linux" per le interruzioni di riga:
</li>
</div><div class="substance">
<label class="ocn"><a name="635" href="#635" class="lnkocn">635</a></label>
<p class="i0" id="o635">
Sbagliato:
</p>
</div><div class="substance">
<label class="ocn"><a name="636" href="#636" class="lnkocn">636</a></label>
<p class="code" id="o636">
if foo; then<br />
bar<br />
fi<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="637" href="#637" class="lnkocn">637</a></label>
<p class="i0" id="o637">
Corretto:
</p>
</div><div class="substance">
<label class="ocn"><a name="638" href="#638" class="lnkocn">638</a></label>
<p class="code" id="o638">
if foo<br />
then<br />
bar<br />
fi<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="639" href="#639" class="lnkocn">639</a></label>
<li class="bullet" id="o639">
Lo stesso vale per le funzioni:
</li>
</div><div class="substance">
<label class="ocn"><a name="640" href="#640" class="lnkocn">640</a></label>
<p class="i0" id="o640">
Sbagliato:
</p>
</div><div class="substance">
<label class="ocn"><a name="641" href="#641" class="lnkocn">641</a></label>
<p class="code" id="o641">
foo () {<br />
bar<br />
}<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="642" href="#642" class="lnkocn">642</a></label>
<p class="i0" id="o642">
Corretto:
</p>
</div><div class="substance">
<label class="ocn"><a name="643" href="#643" class="lnkocn">643</a></label>
<p class="code" id="o643">
foo ()<br />
{<br />
bar<br />
}<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="644" href="#644" class="lnkocn">644</a></label>
<p class="bold" id="o644"><a name="644"></a> <a name="h14.4" id="h14.4"></a>
<a name="14.4" ></a><a name="h14.4" ></a>14.4 Variabili
</p>
</div><div class="substance">
<label class="ocn"><a name="645" href="#645" class="lnkocn">645</a></label>
<li class="bullet" id="o645">
Le variabili vanno sempre scritte in maiuscolo.
</li>
</div><div class="substance">
<label class="ocn"><a name="646" href="#646" class="lnkocn">646</a></label>
<li class="bullet" id="o646">
Le variabili usate in <tt>lb config</tt> iniziano sempre con il prefisso <tt>LB_</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="647" href="#647" class="lnkocn">647</a></label>
<li class="bullet" id="o647">
Le variabili interne temporanee in <i>live-build</i> dovrebbero iniziare con il prefisso <tt>_LB_</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="648" href="#648" class="lnkocn">648</a></label>
<li class="bullet" id="o648">
Le variabili locali iniziano con il prefisso <i>live-build</i> <tt>__LB_</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="649" href="#649" class="lnkocn">649</a></label>
<li class="bullet" id="o649">
Le variabili in <i>live-config</i> relative ai parametri di avvio iniziano con <tt>LIVE_</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="650" href="#650" class="lnkocn">650</a></label>
<li class="bullet" id="o650">
Tutte le altre variabili in <i>live-config</i> iniziano con il prefisso <tt>_</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="651" href="#651" class="lnkocn">651</a></label>
<li class="bullet" id="o651">
Intorno alle variabili utilizzare le graffe; ad esempio scrivere <tt>${FOO}</tt> invece di <tt>$FOO</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="652" href="#652" class="lnkocn">652</a></label>
<li class="bullet" id="o652">
Proteggere sempre le variabili con le virgolette per rispettare potenziali spaziature: scrivere <tt>"${FOO}"</tt> e non <tt>${FOO}</tt>.
</li>
</div><div class="substance">
<label class="ocn"><a name="653" href="#653" class="lnkocn">653</a></label>
<li class="bullet" id="o653">
Per ragioni di coerenza, usare sempre le virgolette quando si assegnano valori alle variabili:
</li>
</div><div class="substance">
<label class="ocn"><a name="654" href="#654" class="lnkocn">654</a></label>
<p class="i0" id="o654">
Sbagliato:
</p>
</div><div class="substance">
<label class="ocn"><a name="655" href="#655" class="lnkocn">655</a></label>
<p class="code" id="o655">
FOO=bar<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="656" href="#656" class="lnkocn">656</a></label>
<p class="i0" id="o656">
Corretto:
</p>
</div><div class="substance">
<label class="ocn"><a name="657" href="#657" class="lnkocn">657</a></label>
<p class="code" id="o657">
FOO="bar"<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="658" href="#658" class="lnkocn">658</a></label>
<li class="bullet" id="o658">
Utilizzando variabili multiple, quotare l'intera espressione:
</li>
</div><div class="substance">
<label class="ocn"><a name="659" href="#659" class="lnkocn">659</a></label>
<p class="i0" id="o659">
Sbagliato:
</p>
</div><div class="substance">
<label class="ocn"><a name="660" href="#660" class="lnkocn">660</a></label>
<p class="code" id="o660">
if [ -f "${FOO}"/foo/"${BAR}"/bar ]<br />
then<br />
foobar<br />
fi<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="661" href="#661" class="lnkocn">661</a></label>
<p class="i0" id="o661">
Corretto:
</p>
</div><div class="substance">
<label class="ocn"><a name="662" href="#662" class="lnkocn">662</a></label>
<p class="code" id="o662">
if [ -f "${FOO}/foo/${BAR}/bar" ]<br />
then<br />
foobar<br />
fi<br /><br />
</p>
</div><div class="substance">
<label class="ocn"><a name="663" href="#663" class="lnkocn">663</a></label>
<p class="bold" id="o663"><a name="663"></a> <a name="h14.5" id="h14.5"></a>
<a name="14.5" ></a><a name="h14.5" ></a>14.5 Varie
</p>
</div><div class="substance">
<label class="ocn"><a name="664" href="#664" class="lnkocn">664</a></label>
<li class="bullet" id="o664">
Per le chiamate a sed utilizzare "<tt>|</tt>" (senza virgolette intorno) come separatore, ad esempio "<tt>sed -e 's|foo|bar|'</tt>" (senza "").
</li>
</div><div class="substance">
<label class="ocn"><a name="665" href="#665" class="lnkocn">665</a></label>
<li class="bullet" id="o665">
Non utilizzare il comando <tt>test</tt> per prove o confronti, usare "<tt>[</tt>" "<tt>]</tt>" (senza ""); ad esempio "<tt>if [ -x /bin/foo ]; ...</tt>" e non "<tt>if test -x /bin/foo; ...</tt>".
</li>
</div><div class="substance">
<label class="ocn"><a name="666" href="#666" class="lnkocn">666</a></label>
<li class="bullet" id="o666">
Ove possibile utilizzare <tt>case</tt> invece di <tt>test</tt>, essendo più facile da leggere e più veloce in esecuzione.
</li>
</div></div><br /><div class="main_column">
<table summary="segment navigation band" bgcolor="#ffffff" width="100%"><tr>
<td width="70%" align="center">
<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="#ffffff">
<td align="center" bgcolor="#ffffff">
<a href="sisu_manifest.it.html" target="_top" >
<font face="verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman" size="2">
[ document manifest ]
</font>
</a>
</td>
</tr></table>
</td>
<td width="5%" align="right">
<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0">
<tr>
<td align="center" bgcolor="#ffffff">
<a href="bugs.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_prev_red.png" alt="<< previous" />
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="toc.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_up_red.png" alt="TOC" />
</a>
</td>
<td align="center" bgcolor="#ffffff">
<a href="procedures.it.html" target="_top" >
<img border="0" width="22" height="22" src="../_sisu/image_sys/arrow_next_red.png" alt="next >>" />
</a>
</td>
<td>
</td></tr>
</table>
</td></tr>
</table>
<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#eeeeee align="center">
<tr><td align="left">
<a href="bugs.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt="<" />
</a>
</td>
<td align="center">
<a href="toc.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt="^" />
</a>
</td>
<td align="right">
<a href="procedures.it.html" target="_top" >
<img border="0" width="100%" height="20" src="../_sisu/image_sys/dot_white.png" alt=">" />
</a>
</td></tr>
</table>
</div><div class="main_column">
<a name="bottom" id="bottom"></a>
<a name="down" id="down"></a>
<a name="end" id="end"></a>
<a name="finish" id="finish"></a>
<a name="stop" id="stop"></a>
<a name="credits" id="credits"></a>
</div></div></body>
</html>
|