Threesuns

Email the Instructor

Contact

All Semesters

Semesters

All Courses

Courses

2012Spring

01.09.12 - 05.06.12

Introduction to UNIX/Linux

CSCI1483

Tuesday Thursday
01:00 PM - 02:20 PM

Shell Scripting I

Lab07

Objective: To work with the vi editor to create a shell script

pastdue

Submit Your Solution

Lab07

Requirements

Shell script entered correctly15 pts
Shell script made executable5 pts
Total20 pts

Instructions

Use vi to create a shell script called wherearethey in your bin directory by entering the following script:

echo -n "Who are you looking for: "
read user

if [ -n "$user"  ]
then
  list=`w | grep $user | cut -c19-30`

  if [ "$list" != "" ]
  then
    echo "The user $user is logged in from $list"
  else
    echo "The user $user is not logged in now"
  fi
fi

Make the script executable and run the script. Make an attempt to understand what the script is doing and how it is doing it.