The language is Linux/Unix gedit You are required to write the following two scr
ID: 3729397 • Letter: T
Question
The language is Linux/Unix gedit
You are required to write the following two scripts.
Getting User Input
Write a script called nosy that will do the following:
a. Ask the user's full name--first, last, and middle name.
b. Greet the user by his or her first name.
c. Ask the user's login name and print his or her user ID (from /etc/passwd)
d. Tell the user his or her home directory (the user entered via step c, not currently logged in).
e. Show the user the processes he or she is running (the user entered via step c, not currently logged in user)
g. Tell the user the day of the week, and the current time in non-military time. The output should resemble:
"The day of the week is Tuesday and the current time is 04:07:38 PM."
Conditional Statements
Write a script called checking that will do the following:
a. Take a command-line argument, a user's login name.
b. Test to see if a command-line argument was provided.
c. Check to see if the user is in the /etc/passwd file. If so, the script will print:
"Found " " in the /etc/passwd file."
Otherwise, the script will print:
"No such user on our system"
Explanation / Answer
ANSWER:
SCRIPT;
THE BELOW SHOWS THAT THE SCRIPT FOR THE GiVEN DATA
$ vi nosy
#
#
# script to display user’s first,middle,last name
#
clear
echo” $FNAME$M NAME$L NAME
echo”Hello $f NAME $MNAME $LNAME
Read-p”enter your birth year;”
Read-p”enter your month:”
Yearnow=$(date’+%y’)
Monthnow=$(date’+%m’)
Agey=$(($yearnow-$year))
Agem=$(($monthnow-$month)
If[age-1t 0]:then
Age m =$(($monthnow-$month+12))
else
Agem=$(($monthnow-$month)
echo” you are $ age y years and $ agem months old!”
echo”current date and time:$(date)”
echo”currentlylogged on users:”
echo $date +”%T”
echo $ date + “%A”
echo $ date +”%a”
echo$week day name+”%A”
echo $month name+”%B”
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.