<span style="font-family:courier;font-weight:bold;padding-left:4px;margin-left:15px;">
#!/bin/bash # Forces script to run in the bash shell<br>
<br>
# Author: *** INSERT YOUR NAME ***<br>
# Date: *** CURRENT DATE ***<br>
#<br>
# USAGE: ./report.bash<br>
<br> <br> if [ $USER != "root" ] # checks to see if user is root, and exits script if not<br> then<br> echo "You must be logged in as root to run the command." >&2 # >&2 is a "redirection trick" to convert output as stderr<br> echo "Either login as root or issue command \"sudo ./report1.bash\"" >&2<br> exit 1<br> fi<br>
</span>
<span style="font-family:courier;font-weight:bold;padding-left:4px;margin-left:15px;">
# Create report title<br>
<br> echo "SOFTWARE ASSET REPORT FOR INSTALLED LINUX SYSTEM" > /root/report.txt<br> echo "Date: $(date +'%A %B %d, %Y (%H:%M:%p)')" >> /root/report.txt<br> echo >> /root/report.txt<br>
<br>
</span>
<span style="font-family:courier;font-weight:bold;padding-left:4px;margin-left:15px;">
echo >> /root/report.txt<br> echo "Hostname: $(hostname)" >> /root/report.txt<br> echo >> /root/report.txt<br> echo >> /root/report.txt<br> echo "Kernel Version: $(uname -rv)" >> /root/report.txt<br> echo >> /root/report.txt<br>
</span>