Scripting
I've just started a class on scripting and have run into a wall. Can anyone help/hint with this?
Write a shell script to ask for name, major, and expected graduation year. The output should be split onto 3 lines. Write a shell script to find the sum, the average, and the product of 4 integers entered by the user. The output should be split onto 3 lines Write a shell script to check whether or not the provided year is a leap year. The output should be the word yes or no Write a shell script to display all usernames that contains a given pattern of characters. You will need to use the cut and grep commands against the /etc/passwd file to do this. |
They won't help do your homework for you (see the LQ rules about homework/classwork). You need to post what you have tried using the code tags too to make it readable.
I see you have lots of these questions. posting search. |
jkirchner is correct in noting that LQ members are not here to be your "on call" support team.
This also was cited in your former question on the topic of scripting. Below is a cut and paste from the LQ Welcome link, as well as a reminder about the LQ Rules Quote:
Here are a couple tips that will enable us to help you moving forward: When asking a question, be sure to provide as many relevant details as possible. You should include the distribution and version you're using, along with hardware details, application version and exact error messages where applicable. Using a descriptive title will vastly increase the number of members who see your thread, and therefore make a response significantly more likely. If you're actively troubleshooting an issue you should also include any steps you've already taken. You may want to include how what you are experiencing differs from what you expected to experience. Before posting, have you used the search function to ensure your question hasn't been asked before? You can edit your post by clicking the EDIT button in the bottom right corner of your message. If you are unwilling or unable to ask questions in a manner that allows us to help you, it's unlikely our community will be able to provide you a solution. Unfortunately, serial offenders who show wanton disregard for this request after multiple pointers may be asked to seek help elsewhere. We truly hope that isn't necessary, and assure you Linux and Open Source are extremely rewarding and well worth the learning curve in the long run. Some additional reading that may help: LQ Search LQ Sitemap LQ Site FAQ How to ask technical questions to get quality answers |
Quote:
http://www.linuxquestions.org/questi...ng-4175598825/ |
Show us your work.
|
Too mean, removed.
|
Quote:
|
Well, I think we both know there's no education in the second kick of a mule.
If the OP continues on like this, he'll discover soon enough the error of his ways, moments after his boss in all likelihood.:) |
best way to figure out a script in writing it is, one step at a time. Lets look at all of the steps you will be needing to do to get a complete script to do what you need it to do.
1. Quote:
http://tldp.org/LDP/Bash-Beginners-G...ect_08_02.html output https://www.cyberciti.biz/faq/how-to...t-to-terminal/ math http://faculty.salina.k-state.edu/ti...bash/math.html another separate script, or within the same one. Does not matter really, just need to have it do one first then the next. 2. Quote:
3. Quote:
4. Quote:
https://www.cyberciti.biz/faq/howto-...in-linux-unix/ cut http://www.computerhope.com/unix/ucut.htm that is a lot of homework you want to take credit for others doing the work for you. Do you not think? Remember what I said in the beginning of this post, take it one step at a time. rule of thumb: if you can do it in the command line then it can be done in a script. the use of a function is my take on it, not the teachers. He or she may or may not like the student showing any kind of initiative. Function http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-8.html Bonus Points: leap year http://www.programmingunit.com/2013/...eck-leap-year/ you'd be surprised what one can find out on the internet now days. |
I can literally google each sentence starting with "Write a shell script to " in the Opening Post and find answers and examples.
|
Quote:
I got them all done by hand myself. Last two in functions leap year and the grep + cut = user names all 4 in the same script. what happen to that OP? |
All times are GMT -5. The time now is 08:35 AM. |