13,420
edits
Changes
no edit summary
<ol><li value="6">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. Add the following content to your shell script editing session:</li></ol>
<code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;font-weight:bold;">
<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.txt<br>
done<br>
<br>