Q:- Write a shell script to display the name of the operating system, the login name and the host name using BASH scripting.
Code
#!/bin/bash echo "shell script to display operating system name,login name and host name" while true do echo "Enter your choice" echo "1.Display name of OS 2.Display Login name 3.Display host name 4.exit" read choice case $choice in 1) echo "name of operating system: `uname -o`" echo "Kernel name : `uname -s`" echo "Kernel version:`uname -v`" ;; 2) echo "login name:`logname`" ;; 3) echo "host name:`hostname`" ;; 4) echo "terminating script" break ;; *) echo "invalid choice, please enter values between 1 and 4 only" ;; esac done
No comments:
Post a Comment