27.08.2015 Views

Advanced Bash−Scripting Guide

Advanced Bash-Scripting Guide - Nicku.org

Advanced Bash-Scripting Guide - Nicku.org

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Advanced</strong> <strong>Bash−Scripting</strong> <strong>Guide</strong><br />

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

esac<br />

return 0<br />

# Which yields (if you are lucky, and have "stat" installed)<br />

# −*−*− Location Discriptor −*−*−<br />

# Return code: 0<br />

# Size of array: 15<br />

# Contents of array<br />

# Element 0: /home/mszick 20th Century name<br />

# Element 1: 41e8 Type and Permissions<br />

# Element 2: 500 User<br />

# Element 3: 500 Group<br />

# Element 4: 303 Device<br />

# Element 5: 32385 inode<br />

# Element 6: 22 Link count<br />

# Element 7: 0 Device Major<br />

# Element 8: 0 Device Minor<br />

# Element 9: 1051224608 Last Access<br />

# Element 10: 1051214068 Last Modify<br />

# Element 11: 1051214068 Last Status<br />

# Element 12: 0 UUID (to be)<br />

# Element 13: 0 Volume Label (to be)<br />

# Element 14: ef53 Filesystem type<br />

}<br />

# And then there was some test code<br />

ListArray() # ListArray Name<br />

{<br />

local −a Ta<br />

}<br />

eval Ta=\( \"\$\{$1\[@\]\}\" \)<br />

echo<br />

echo "−*−*− List of Array −*−*−"<br />

echo "Size of array $1: ${#Ta[*]}"<br />

echo "Contents of array $1:"<br />

for (( i=0 ; i

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

Saved successfully!

Ooh no, something went wrong!