|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
c shell scripting problem(HELP!!!)
can anyone help with the following scripting problem:
i need these implemented so the client can perform the tasks in the menu on the files. 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 - 25 records in each. Cheers |
|
#2
|
||||
|
||||
|
Which bit are you having difficuilty with?
christo
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > c shell scripting problem(HELP!!!) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|