Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN
Pages: 3
Words: 418

You are viewing 1/3rd of the document.
Purchase the document to get full access instantly.

Immediately available after payment
Both online and downloadable
No strings attached

Awk print echo display disk spaceif display true then echo available disk space echo

#!/bin/bash

# Initialize options

display_memory_info=false

display_disk_space=false

    h) # Help menu

      echo "Usage: sysinfo.sh [-h] [-n] [-i] [-p] [-a] [-o] [-c] [-m] [-d]"

      echo "  -n  Display system name with domain name"

      echo "  -i  Display IP addresses for this host by interface"

      echo "  -m  Display memory installed"

      exit 0

    i) # Display IP addresses

      display_ip_addresses=true

    a) # Display disk space

      display_disk_space=true

    c) # Display CPU info

      display_cpu_info=true

    \?) # Invalid option

      echo "Error: Invalid option -$OPTARG" >&2

# Display system name

if [ "$display_system_name" = true ]; then

if [ "$display_ip_addresses" = true ]; then

  echo "IP Addresses:"

  echo ""

fi

  lpstat -a | awk '{print $1}'

  echo ""

  echo ""

  df -h | grep "^/dev/" | awk '{print $1": "$4" free out of "$2}'

  echo "OS Version and Name:"

  echo ""

if [ "$display_cpu_info" = true ]; then

  echo "CPU Description:"

# Display memory info

if [ "$display_memory_info" = true ]; then

Copyright © 2009-2023 UrgentHomework.com, All right reserved.