Download as:
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Language:EN
Pages: 7
Words: 520

Accept acommand line option for each item

College: Amity University

QUESTION:

• System name with domain name if it has one.

• IP addressesforthis host by interface, leave outlocalhostloopback network.

• List of printers configured.

#Code :

echo " 4 -> CPU description "

echo " 5 -> Memory installed "

then

val=hostnamectl

${val}

elif [ ${REPLY} == 3 ]

val=lscpu

${val}

elif [ ${REPLY} == 6 ]

then

val="lpstat -t"

${val}

  1. I have used if else and elif conditions to implement this code.

  2. As, we were given to implement and execute the given requirements. I have used Linux commands to fulfill the requirements.

• CPU description

• Memory installed.

Hostnamectl -> is used to get the info of all the system name and domain name of Redhat as mentioned in the question

  1. OS version and name:

OUTPUT: cat /etc/redhat-release -> contains all the info of OS version and name too..

Lscpu -> it contains the all the information related to CPU, name of CPU Architecture used in CPU etc

  1. Memory installed.

Output:

lpstat -t -> it shows the list of printers configured to the system

At last if we given the option which was incorrect, it prompts that “Enter the correct option”

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