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.

T=( $(ls --inode --ignore-backups --almost-all --<strong>di</strong>rectory \<br />

--full-time --color=none --time=status --sort=none \<br />

--format=long $1) )<br />

case $of in<br />

# Assign T back to the array whose name was passed as $2<br />

0) eval $2=\( \"\$\{T\[@\]\}\" \) ;;<br />

# Write T into filename passed as $2<br />

1) echo "${T[@]}" > "$2" ;;<br />

esac<br />

return 0<br />

}<br />

# # # # # Is that string a legal number? # # # # #<br />

#<br />

# IsNumber "Var"<br />

# # # # # There has to be a better way, sigh...<br />

IsNumber()<br />

{<br />

local -i int<br />

if [ $# -eq 0 ]<br />

then<br />

return 1<br />

else<br />

(let int=$1) 2>/dev/null<br />

return $? # Exit status of the let thread<br />

fi<br />

}<br />

# # # # # Index Filesystem Directory Information # # # # #<br />

#<br />

# IndexList "Field-Array-Name" "Index-Array-Name"<br />

# or<br />

# IndexList -if Field-Array-Filename Index-Array-Name<br />

# IndexList -of Field-Array-Name Index-Array-Filename<br />

# IndexList -if -of Field-Array-Filename Index-Array-Filename<br />

# # # # #<br />

:

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

Saved successfully!

Ooh no, something went wrong!