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.

name=Lidx<br />

case $ft in<br />

-) ((Lidx+=1)) ;; # The easy one<br />

b) ((Lidx+=1)) ;; # Block device<br />

c) ((Lidx+=1)) ;; # Character device<br />

d) ((Lidx+=1)) ;; # The other easy one<br />

l) ((Lidx+=3)) ;; # At LEAST two more fields<br />

# A little more elegance here would handle pipes,<br />

#+ sockets, deleted files - later.<br />

*) until IsNumber ${LIST[$Lidx]} || ((Lidx >= Lcnt))<br />

do<br />

((Lidx+=1))<br />

done<br />

;; # Not required<br />

esac<br />

INDEX[${#INDEX[*]}]=$inode<br />

INDEX[${#INDEX[*]}]=$name<br />

INDEX[0]=${INDEX[0]}+1 # One more "line" found<br />

# echo "Line: ${INDEX[0]} Type: $ft Links: $m Inode: \<br />

# ${LIST[$inode]} Name: ${LIST[$name]}"<br />

else<br />

((Lidx+=1))<br />

fi<br />

done<br />

case "$of" in<br />

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

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

esac<br />

return 0 # What could go wrong?<br />

}<br />

# # # # # Content Identify File # # # # #<br />

#<br />

# DigestFile Input-Array-Name Digest-Array-Name<br />

# or<br />

# DigestFile -if Input-FileName Digest-Array-Name<br />

# # # # #<br />

# Here document used as a comment block.<br />

:

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

Saved successfully!

Ooh no, something went wrong!