Author
Topic: Shell Scripting Help (Read 10663 times)

I am looking for help in figuring out exactly what I need to do and if someone can help me figure it out, it would get me out of a huge jam. I am including what i'm being asked to do and will show an example I was given, I was told that the example could be altered to do what is asked below, I just don't understand this script stuff at all.

Ty,

Chris

Case – switch 2, 9 points (3 if it runs correctly, 5 if all components are included and 1 for comments) and yes we live in a partial credit world. This project is an extension of the case and switch assignment from last week. We have used all the elements of this script in prior homework projects, puzzles and/or scripts. This time around everything is a choice in a case switch script. Your shell script will use case and switch and should include the following elements: some kind of conditional test to proceed (date, verify users is logged, etc) request the user’s name (save as a variable to be used at exit) a counter that counts the number of total choices made by the user a use of the cut command (cut a field from you friends list or some other file) an option to run 5 different commands (ls, who, ping etc) and on exiting the script, echo the user’s name, user inputs (you will want to save these as varialbes and how many choices the user made). Comments MUST be included in the script! Your script should be easy for anyone to run without the need of prompting from you, the developer. Email a copy and leave an executable copy in the appropriate homework directory. Remember, by reading your comments I should be able to see exactly what your script is doing (or suppose to do). Why use comments? Comments force you to think through the scripting process. Scripting could be considered a mechanical process of converting your comments into UNIX commands. *** READ the following paragraph to help you with your puzzle!! Trouble shooting your script (in case you need it)…. This script has more elements and more potential to bonk, crash, not work. What you should do is start with the BASIC C-S script and start adding elements to the known to work script. If the script bonks and before you declare yourself “lost”(remember lost is a television show!), comment out newly added lines until the script works again. Now you have a block of code that needs to be carefully reviewed. If we were sitting in a face-to-face class this is exactly the process we [YOU] would be asked to do. Start with a simple script (the frame work from last week is a good starting point) and develop it from there, don’t forget to make copies of your work along the way!!

First let me apologize for the posting I am asking for help for this one time, I have had to deal with my future mother in law and father in law almost passing away on us and it led me to fall behind a little. I have also been sick with the flu, so if anyone can please help me with this, i would be grateful. I certainly will still pose a question or 2 in the future but this would be the only time i'd ask for this much help. With my frame of mind trying to understand how to put together this long script is very hard for me, i'm trying to research it and figure it out but I have till Monday and not sure I can do it.

I made a small error I had included 2 separate script statements thinking they were all one, the 2nd was in C-shell and did not not that. So I will post the one only for help and what i've done so far. I am getting an undefined variable, it brings up he date I want but the variable error shows and it is because of line 5. Also below what I have done so far is the script I am trying to alter into a working script, let me stress this is not a test or anything just I have been having to deal with a future mother in law and father in law that were hospitalized a week apart so I fell behind on a little of my work so I am desperate for help.

Below is something I needed help with, it is something similar to what I had gotten some help on

case and switch script should: -request a user name, -request 8 numbers and ask the user if they are to be added or sorted (both need to work!) OR request 8 names (1st and last) and sort them by the second field (check the hints and tips sheet for multi part user input), -multiply two numbers from user input, - give the user the choice of running; ‘who’, ‘w’ or ‘finger’ and echo only the first and third columns to the screen (save this also for exit echo), - have a conditional ‘while’ statement, - track the number of choices the users makes (use a counter), - have at least 2 if statements, - include an option that will add from a start number and end at another number using user input for all numbers including the increment number