13,420
edits
Changes
no edit summary
{|width="40%" align="right" cellpadding="10"
|- valign="top"
|{{Admon/tip|Bash Shell Scripting Tips:|<br>'''<u>Arrays</u>'''<br><br><ul><li>Incredibly useful tool that works like a "storage container" of variables. Arrays have names like variables, but are numbered for quick storage and access. Indices are I.D. numbers for array access. The first index starts at zero instead of 1.<br><br></li><li>Instead of using index numbers, you can use I.D. names - this is referred to as an Associative Array.<br><br></li><li>Examples:<br><br>''awk #!/bin/bash''<br>''for((x=0; x<5; x++))''<br>'{print}' data-file.txtdo''<br>''awk read -Fp ";Enter item #$((x+1)): " item[$x]''<br>''done''<br>'{print $'for((y=0; y<5,$3}; y++))''<br>'' data-file.txtdo''<br>''awk -F"," 'echo $4 >= 10000 {print $1, $2item[y]}' salary.txt'<br>''done''<br><br></li></ul>}}
|}