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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

# The ’for illustration’ function form<br />

_protect_literal_str() {<br />

# Pick an un-used, non-printing character as local IFS.<br />

# Not required, but shows that we are ignoring it.<br />

local IFS=$’\x1B’ # \ESC character<br />

# Enclose the All-Elements-Of in hard quotes during assignment.<br />

local tmp=$’\x27’$@$’\x27’<br />

# local tmp=$’\”$@$’\” # Even uglier.<br />

}<br />

local len=${#tmp} # Info only.<br />

echo $tmp is $len long. # Output AND information.<br />

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

# This is the short-named version.<br />

_pls() {<br />

local IFS=$’x1B’ # \ESC character (not required)<br />

echo $’\x27’$@$’\x27’ # Hard quoted parameter glob<br />

}<br />

# :

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

Saved successfully!

Ooh no, something went wrong!