13,420
edits
Changes
no edit summary
<br>
Finally , we will use a loop to printout the results of the data (stored in the Associative Arrays) in a report file called: /root/network-info.txt
The command at the end is a trick to remove all temporary files that have the same extension as the current PID number, therefore, it is unique.
<br><br>
<ol><li value="6">Add the following content to your shell script editing session:</li></ol>
<br><code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight:bold;"><br>for x<br>do<br> echo "Network Information for: \"$x\":" > /root/network-info.txt<br> printf '%s\n' "${$x[@]}" | tail -n +2 > /root/network-info.txt<br> echo > /root/network-info.txtdone<br><br>rm /tmp/*.$$ </code><br>