yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Shell Scripting Lesson 1


3m read
·Nov 3, 2024

Processing might take a few minutes. Refresh later.

Hey guys, this is Matt. Kids on one and today is going to be, um, shell scripting lesson one.

The deal with this is that there's a programming language basically built into terminal that you probably don't know about. It's not really considerably a programming language, but it's pretty powerful, and there are a bunch of scripts on your computer that use it that you probably don't know about.

So let me just, um, explain this to you. When you open up terminal or iTerm or something like that, you'll notice that, um, basically this command line will come up, and it lets you type commands. But, say you use something like iTerm instead of terminal; yeah, it's exactly the same, except for maybe the GUI of the application, but the text is all the same.

Let me explain to you why, because this is actually a terminal application running in terminal. Um, so terminal is just one big terminal application running in terminal called bash or sh or a sh or whatever these are called. Shells, and the shell is basically something that handles the login, handles commands, handles, you know, prompts, and handles closing programs and running new programs and stuff like that.

So shell, this might, my shell is processing this. If I hit like a sh, it's not installed, but zsh I think I might have; you can see it's a different prompt here. The shell is a little bit different. If I type csh, it might be in here. Then this is, um, shell scripting or more like c. But I'm basically, let me just explain to you what your default shell is. It's bash, be a sh.

Um, and this is basically a shell that processes commands. You might have noticed that the command line, if you type while true to enter, it'll ask you to type another one. You can type echo, you know, hi, and then you can type done, and then it'll keep on printing out hi, something like that. Well, that was just a shell script that we wrote there because the point is that this shell is like a programming language, and you can program it at the command line.

Normally, typically, you can only program one line programs. So if you type ls, that's a one line program. The only command in that whole program is ls. Or, if you want to type multiple commands, it can be ls semicolon space ls dash out our /. Then first, I'll type ls then gl a special r /. Instantly, but, um, maybe you don't enjoy that so much and you want to do something else.

So maybe you want to write a shell script. If you do want to learn some shell scripting, feel free to watch our shell scripting to video, and it will show you how to write a program effectively and easily using bash and terminal. It's pretty powerful; it allows you to, um, do if statements, check if files exist, have command line parameters.

Info 101 was written mostly with, um, Perl, but there was a lot of shell scripting involved in it. I'll just show you real quick, um, what info 101 really looks like. If you take a look at the source code of it, because it's actually open source, just if you open it with Mac VI, em. So I'll just open it with Mac VI m, and right here you can see, um, it's all shell scripting. This is really simple shell.

So info 101 was written mostly in shell scripting. That is why you should learn shell scripting; it's just pretty powerful. So thanks for watching. Makinson on, check out RM's shell scripting to video right now because it'll have all the information you need on how to shell script. So, I thanks for watching him b...

More Articles

View All
Civic engagement | Citizenship | High school civics | Khan Academy
[Instructor] Civic engagement is defined as the actions of local leaders and residents to improve their community and the lives of their community members. It’s important to think about these terms pretty broadly. We tend to think about community as a wor…
How to negotiate with billionaires.
I negotiate with billionaires every day in what I do. Everybody always asks me, “How do you negotiate with a billionaire, a big corporate executive, and things like that?” To tell you the truth, you negotiate with them just like you negotiate with anybod…
Understand Where YOU are in the Life Cycle
There’s a life cycle of an individual, so I want to just touch on that for a bit. To me, the life cycle of a typical individual looks like this: In the first phase, you learn, and you’re dependent on others who guide you, most importantly your parents an…
7 STOIC SIGNS OF RELATIONSHIP INCOMPATIBILITY | STOICISM INSIGHTS
Welcome back to Stoicism Insights. Today we’re diving deep into the intricacies of relationships through the lens of Stoic philosophy. Have you ever wondered what signs might indicate a fundamental misalignment in your relationships? Stick around, because…
Joel Greenblatt on How to Achieve a 40% Return a Year
So if you believe what Ben Graham said, that this horizontal line is fair value, and this wavy line around that horizontal line are stock prices, and you have a disciplined process to buy perhaps more than your fair share when they’re below the line, and …
Probability with discrete random variable example | Random variables | AP Statistics | Khan Academy
Hugo plans to buy packs of baseball cards until he gets the card of his favorite player, but he only has enough money to buy at most four packs. Suppose that each pack has a probability of 0.2 of containing the card Hugo is hoping for. Let the random vari…