Computing.Net > Forums > Unix > client server UNIX script

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

client server UNIX script

Reply to Message Icon

Original Message
Name: Chelle
Date: April 22, 2003 at 15:14:11 Pacific
Subject: client server UNIX script
OS: unix
CPU/Ram: ?
Comment:

I've got a client script and a server script for an assignment that I'm doing last minute!

Client Script
--------------

echo " select any option to execute:"
echo " c or C: To connect Client to Server"
echo " r or R: To make a read request"
echo " s or S: I want to sort data"
echo " g or G: Look for a certain word in a file"
echo " e or E: quit"
echo -n "Enter your option and press :"
set selection = `head -1`

switch ("$selection")
case [cC]:
echo -n "enter server name"
set servername = `head -1`
find $servername
breaksw

case [rR]:

cp
echo -n "enter server file to read content"
set serverfile = `head -1`
breaksw

case [sS]:

sort
echo -n "enter server file to sort"
set serverfile1 = `head -1`
breaksw

case [qQ]:

exit 0

breaksw

default:

case [qQ]:

exit 0

breaksw

default:
echo " wrong option."
exit 1
breaksw
endsw
exit 0


--

Server script
--------------

if (($servername[1] == option1)) then
set servername =``
echo "main server is connected" >> ./monitor/serverlock
echo "main server is connected"
endif

if ($argv[1] == 'option4') then
echo -n "enter file to search:"
set datafile = `head -1`
echo -n "enter word or data to search:"
set data = `head -1`
echo ""
echo -n $data
echo -n $datafile
grep -i $data $datafile
echo ""
echo ""
endif

if (($argv[1] == option2)) then
echo -n "enter file to read:"
set datafile = `head -1`
if (($datafile == course)) then
cat course && cat course> ServerMaster1
echo "read the course file" >> ./monitor/courselock
else if (($datafile == student)) then
cat student && cat student > ServerMaster2
echo "read the student file" >> ./monitor/studentlock
else if (($datafile == exam)) then
cat exam && cat exam > ServerMaster3
echo "read the exam file" >> ./monitor/examlock
endif
endif

if ($argv[1] == 'option3') then
echo -n "enter file to sort:"
set datafile = `head -1`
if (-e $datafile) then
sort $datafile
echo -n "server sorted"
end if
endif

I also have .csh files named student, exam and course


I'm using Delta (and Telnet) and have all my files in one folder, but don't know where to start and don't know how the server will know its being sent a request.

Thanks in Advance.

Chelle


Report Offensive Message For Removal








Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software