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.

}<br />

eval $2=\( \$\{_ul_out\[@\]\} \)<br />

set +f<br />

return 0<br />

# This function described in char_convert.bash.<br />

# to_lower <br />

to_lower() {<br />

[ $# -eq 1 ] || return 1<br />

local _tl_out<br />

_tl_out=${1//A/a}<br />

_tl_out=${_tl_out//B/b}<br />

_tl_out=${_tl_out//C/c}<br />

_tl_out=${_tl_out//D/d}<br />

_tl_out=${_tl_out//E/e}<br />

_tl_out=${_tl_out//F/f}<br />

_tl_out=${_tl_out//G/g}<br />

_tl_out=${_tl_out//H/h}<br />

_tl_out=${_tl_out//I/i}<br />

_tl_out=${_tl_out//J/j}<br />

_tl_out=${_tl_out//K/k}<br />

_tl_out=${_tl_out//L/l}<br />

_tl_out=${_tl_out//M/m}<br />

_tl_out=${_tl_out//N/n}<br />

_tl_out=${_tl_out//O/o}<br />

_tl_out=${_tl_out//P/p}<br />

_tl_out=${_tl_out//Q/q}<br />

_tl_out=${_tl_out//R/r}<br />

_tl_out=${_tl_out//S/s}<br />

_tl_out=${_tl_out//T/t}<br />

_tl_out=${_tl_out//U/u}<br />

_tl_out=${_tl_out//V/v}<br />

_tl_out=${_tl_out//W/w}<br />

_tl_out=${_tl_out//X/x}<br />

_tl_out=${_tl_out//Y/y}<br />

_tl_out=${_tl_out//Z/z}<br />

echo ${_tl_out}<br />

return 0<br />

}<br />

#### Application helper functions ####<br />

# Not everybody uses dots as separators (APNIC, for example).<br />

# This function described in to_dot.bash<br />

# to_dot <br />

to_dot() {<br />

[ $# -eq 1 ] || return 1<br />

echo ${1//[#|@|%]/.}<br />

return 0<br />

}<br />

# This function described in is_number.bash.<br />

# is_number <br />

Appen<strong>di</strong>ce A. Script aggiuntivi<br />

677

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

Saved successfully!

Ooh no, something went wrong!