Fireship · @fireship
Bash in 100 Seconds
Uploaded August 23, 2021 · Length 2:33
Summary
bash basics: command line, shell, scripting, and automation in 100 seconds.
- bash
- command line
- shell scripting
- unix
- linux
- terminal
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
bash a command language interpreter for
- 0:02
interacting with a computer from the
- 0:04
command line it's also called a shell
- 0:06
because it surrounds the operating
- 0:08
system kernel to hide its intricate
- 0:09
details while allowing you the
- 0:11
programmer to do important stuff like
- 0:13
access data and write files by typing
- 0:16
simple commands this was a revolutionary
- 0:18
concept when it was developed in the
- 0:19
early 70s back when programmers were
- 0:21
still using punch cards the shell
- 0:23
concept evolved over the years with the
- 0:25
bourne shell being the most popular
- 0:26
version that is until 1989 when the
- 0:28
born-again shell or bash came about when
- 0:31
you open up the terminal on a unix
- 0:33
machine like mac os and most linux
- 0:35
distros the default shell is usually
- 0:37
bash it provides a prompt where you can
- 0:40
type a command which will then be
- 0:41
interpreted by the shell and executed on
- 0:43
the operating system to find out if
- 0:45
you're running bash type in which dollar
- 0:47
sign shell from the command line it's
- 0:49
like any other application that lives in
- 0:51
the binaries directory but bash is also
- 0:53
a programming language that allows us to
- 0:55
write scripts which means anything we
- 0:57
type manually into the command line can
- 0:58
be automated with code when you first
- 1:00
launch the shell it actually runs a
- 1:02
startup script that's defined in the
- 1:04
bash profile or bashrc file on your
- 1:07
system this allows you to customize the
- 1:09
behavior and appearance of the shell
- 1:10
whenever you start a new session you can
- 1:12
add your own custom bash scripts to any
- 1:14
project by creating a file that ends in
- 1:16
dot sh for no file extension at all the
- 1:19
first line in that file should always be
- 1:21
a shebang followed by the path to the
- 1:23
application that should run it below
- 1:25
that we can start writing commands like
- 1:27
echo to print something and they'll be
- 1:28
interpreted line by line to create a
- 1:30
variable type a name in all caps
- 1:32
followed by the equal sign then
- 1:34
reference it later in the script using a
- 1:36
dollar sign in front of the name now to
- 1:38
execute the script simply type the file
- 1:40
name into the shell that was easy but
- 1:42
what if we want to pass in some
- 1:44
arguments when we run the script
- 1:45
positional arguments will automatically
- 1:47
be assigned variable names of 1 2 3 and
- 1:50
so on now in other cases you may need
- 1:52
additional user input in the middle of a
- 1:54
script you can create loops in bash like
- 1:56
a do while loop here that will prompt
- 1:58
the user to continue the script on a yes


