LINUX Build a script so it takes the supplied first name of

LINUX

Build a script so it takes the supplied first name of a user and returns the indicated output. The script should retrieve information for the user the script is run against and an error message if no user is found. Users to test will be Jake, Jim, and Notreal. Jake and Jim should return the correct information and Notreal should return an error message of no such person found (as there is no Notreal user).

Solution

#!/bin/sh
firstname=$1;
if [firstname -eq \"Notreal\"]
then
   echo \"No such person found\"
elsif [firstname -eq \"Jake\"]
   echo \"Age of Jake is 25\"
fi  
elsif [firstname -eq \"Jim\"]
   echo \"Age of Jim is 22\"
fi  

Script name : Record.sh

Execution : ./Record.sh Notreal

Output: No such person found

LINUX Build a script so it takes the supplied first name of a user and returns the indicated output. The script should retrieve information for the user the scr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site