#!/bin/bash # this is the code that is to be used for the LAB1 echo welcome to LAB1 ################################################################################### ####### SCRIPTM4 ############################## ################################################################################### ### This script extracts the correponding ip for the student home machine from the ## database file and mounts the appropriate home directory from the "home machine" ################################################################################### #### CREATED BY FAHAD SAEED ifup ath0 bash /home/script/testlogin mylogin=`cat login` echo $mylogin #login-name is stored in file named login # variable for storing the login is mylogin #The login and the appropriate ip are read from the database #the appropriate line from the database is stored in the file named ippluslog grep -f login database>ippluslog #the following command stores the login name and ip address #on two seperate lines and isolates ip address in a seperate file named ip sed 's/[ ][ ]*/\ /g' ippluslog>ippluslog2 #isolating ip comm -23 ippluslog2 login>studentip # now the ip address to which the terminal has to connect is $myip read myip