Bash in 100 Seconds

  • 🎬 Video
  • ℹ️ Published 1 years ago
preview_player
UCsBjURrPoezykLs9EqgamOA

Bash is the command line shell that you encounter when you open the terminal on most Unix operating systems, like MacOS and Linux. Learn how to create your own bash scripts to automate tasks on your computer.

#linux #compsci #100SecondsOfCode

🔗 Resources


🔥 Watch more with Fireship PRO

Use code lORhwXd2 for 25% off your first payment.

🎨 My Editor Settings

- Atom One Dark
- vscode-icons
- Fira Code Font

📖 Topics Covered

- Bash Programming Tutorial
- Linux Command Line Basics
- Bash Scripting
- History of Unix Shells
- Learn to Code with Bash

💬 Comments
Author

fireship is turning us into 10X developers without us even knowing it

Author — azatecas

Author

It's called a SHELL as it hides the kernel

Wow I never thought of it like that :))

Author — Sudip Bhandari

Author

Fun fact: You can use $0 instead of $SHELL to get the actual name of the current shell, not just the path

Author — NastyGamer

Author

Would love a longer bash tutorial as it's syntax can get pretty rough, especially with flags inside if statements which is something unique to bash

Author — Metruzanca

Author

These 100-second videos are so underrated, no one else fully outlines a concept this well. I can see if it's worth learning before I invest my time. 🔥

Author — Alex Reade

Author

That was fast. Now to learn all the branching, variables, pattern matching and syntax intricacies it will take only a 100 weeks. Full-time.

Author — Gregorius

Author

"Rust in 100 seconds" would be cool

Author — Iyxan23

Author

Great video! Note however that by convention variables shouldn't be all caps unless they're environment variables.

Author — SeerLite

Author

add `set -e` at beginning to exit script if any command fails, `set -x` for printing commands that are being executed
very help full while developing script.

Author — π

Author

So, the main take-away from this video is that the operating system is a squishy snail inside a shell?

Author — Lukyan

Author

Literally never wrote shell script and then it happened that I needed to put some code in background processing to the OS and started practicing how to write shell script. Once I got a hang of it, never went back from there. One of the most amazing ways to automate terminal commands and especially more useful to listen directly from your app.

Author — Gregor

Author

I'd love to see a 100s video on a reasonably complex design pattern, like decorator or visitor

Author — Michael Poirier

Author

3 hours of uni classes in 100 seconds. I wish I would have found your channel back in 2019 when I started my CS degree

Author — SebWay

Author

After 5 years of avoiding bash scripts, I was literally at the crossroads to learn it for some specific task. I wake up to find this video in my feed. This guy is a mindreader.

Author — Manik Singh

Author

Bash literally taught me the true power of programming beyond console and libraries.
Like it's the most useful language in automation, when you're just starting.

Author — that's a lot

Author

Some thoughts:

EDIT: Please stop telling me about `#!/bin/sh`. This video is specifically about bash and so is this comment. I am aware that posix sh... exists. If you want to write POSIX compliant scripts, use sh. If you want to write modern scripts, use BASH. Also: even if you use sh instead of bash, you may still be writing bash. The best way to test for that would be shellcheck.
Oh and `/bin/sh` is not specified ny posix either, so you'll probably still want to use `#!/usr/bin/env sh`.

- Please do not use `#!/bin/bash` or `#!/usr/bin/bash` as your shebeng. Instead use `#!/usr/bin/env bash`. This way, bash can be installed pretty much anywhere and it will still work.
- Please always put double qoutes around variables unless you specifically need them unqouted (which you do when loop over an array using a for-loop for example). This will prevent unintended splitting of strings. Note that in bash single qoutes ('), double qoutes (") and backticks (`) all have a different meaning. Speaking of backticks:
- Whenever you see a stackoverflow answer around processing a command's output, you will probably see someone using a command enclosed by backticks. This is deprecated and should not be used. Instead, you can use $(command). However, you should also double qoute that, so "$(command)".
- Variables don't have to be all-caps. However, if you use them like " $VARsomething" where only VAR is the variable name, you may need to use curly brackets to signal bash where the variable starts and ends: "${VAR}something". Those can also be used for substitutions, which I recommend you just look up ;).

Author — SkyyySi

Author

0:17 Command-line interpreters (CLIs) were not a revolutionary concept in 1971. After all, every interactive OS had them, and there were quite a few by that time. What was revolutionary was the idea that the CLI ran as just another ordinary process with no special privileges, rather than being built into the OS.

Author — Lawrence D’Oliveiro

Author

Bash = *Boomer's* Shell
ZSH = *Zoomer's* Shell

Author — Agus Dev

Author

I have been developing software for over a decade and I still hate bash. It would be awesomeness if you wanted to do a longer bash video, that deals with all the counter intuitive intricasies in a way that you can almost make sense of it. Just praying 😃

Author — Armchair Expert

Author

Learning to make simple scripts with Bash makes using Linux way better imo. It allows to automate tasks without installing anything. It's not fully portable but, for what it's meant to do, it's great!

Author — Rafael Pernil