Awk print echofi version and nameif print thenecho version and name etc
*/
//Answer of the given assignment
print_os_info=true
print_cpu_info=true
while getopts ":niahcdmp" opt; do
case $opt in
print_ip_addresses=true
;;
print_cpu_info=true
;;
print_disk_space=true
;;
echo "Invalid option: -$OPTARG" >&2
exit 1
if $print_system_name; then
echo "System Name: $(hostname --fqdn)"
echo "IP Addresses by Interface:"
ip -o addr show | awk '$3 != "lo" {print $2 ": " $4}'
echo "OS Version and Name:"
cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f 2
echo "CPU Description:"
cat /proc/cpuinfo | grep "model name" | uniq | cut -d ":" -f 2 | sed 's/^[ \t]*//'
echo "Memory Installed:"
free -h | grep Mem | awk '{print $2}'
echo "Available Disk Space on Attached Physical Drives:"
df -h | awk '$1 ~ "^/dev/" {print $1 " " $4}'
echo "Printers Configured:"
if lpstat -p 2>/dev/null; then
echo
fi