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}
I have used if else and elif conditions to implement this code.
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
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
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”