13 | arrays

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use arrays in shell scripting. Arrays in shell scripting are a little weird compared to other programming languages. You will know why.



12 | case statement

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use a case statement. If you are familiar with other programming languages than case statement is similar to switch statement.



11 | floating-point operation

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to perform floating-point operation operations. Normal commands which we use for performing arithmetic operation don’t work with floating-point.

In order to perform the floating-point operation, we will be making use of bc command. This command is a really powerful precision calculator.

We will be learning how to perform summation, subtraction, multiplication, division, modulo, square root, and also equality check.



10 | arithmetic operation

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to perform arithmetic operations. It is going to be fun.

We will be learning how to perform summation, subtraction, multiplication, division, and modulo.



9 | ||(or) operator

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use ||(or operator) in a shell script. It is really easy to use and understand this operator.

Just remember statement becomes true if at least one of the conditions is true.

Example: c1 || c2 || c3 || c4 : atleast one of the c1,c2, c3 or c4 must be true for the statement to be true.



8 | &&(and) operator

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use &&(and operator) in shell script. It is really easy to use and understand this operator.

Just remember statement becomes true only if all the conditions are true otherwise it will be false.

Example: c1 && c2 && c3 && c4 : all c1, c2, c3 and c4 must be true for the statement to be true.



7 | file test operators

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use a file condition operator along with if statement. There will be times when you will be dealing with files in your scripts. These operators make it easier for us to check conditions such as is file regular file, file exist or not, and much more.

– – – – File Test Operators – – – – –

The ones we will test:

a : True if the file exists.
e : True if the file exists.
d : True if the file exists and is a directory.
f : True if the file exists and is a regular file.
s : True if the file exists and has a size greater than zero.
r : True if the file exists and is readable.
w : True if the file exists and is writable.
x : True if the file exists and is executable.

The ones we will not test:

b : True if the file exists and is a block special file.
c : True if the file exists and is a character special file.
g : True if the file exists and its SGID bit is set.
h : True if the file exists and is a symbolic link.
k : True if the file exists and its sticky bit is set.
p : True if the file exists and is a named pipe (FIFO).
t : True if file descriptor is open and refers to a terminal.
u : True if the file exists and its SUID (set user ID) bit is set.
O : True if the file exists and is owned by the effective user ID.
G : True if the file exists and is owned by the effective group ID.
L : True if the file exists and is a symbolic link.
N : True if the file exists and has been modified since it was last read.
S : True if the file exists and is a socket.



6 | if statements

Shell Scripting Tutorial


Hello Programmers, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the tutorial series on shell scripting. In this video, we will learn how to use a file condition operator along with if statement. There will be times when you will be dealing with files in your scripts. These operators make it easier for us to check conditions such as is file regular file, file exist or not, and much more.

– – – – File Test Opeartors – – – – –

The ones we will test:

a : True if the file exists.
e : True if the file exists.
d : True if the file exists and is a directory.
f : True if the file exists and is a regular file.
s : True if the file exists and has a size greater than zero.
r : True if the file exists and is readable.
w : True if the file exists and is writable.
x : True if the file exists and is executable.

The ones we will not test:

b : True if the file exists and is a block special file.
c : True if the file exists and is a character special file.
g : True if the file exists and its SGID bit is set.
h : True if the file exists and is a symbolic link.
k : True if the file exists and its sticky bit is set.
p : True if the file exists and is a named pipe (FIFO).
t : True if file descriptor is open and refers to a terminal.
u : True if the file exists and its SUID (set user ID) bit is set.
O : True if the file exists and is owned by the effective user ID.
G : True if the file exists and is owned by the effective group ID.
L : True if the file exists and is a symbolic link.
N : True if the file exists and has been modified since it was last read.
S : True if the file exists and is a socket.



1 | introduction

Shell Scripting Tutorial


Hello, I’m Yash. Sole programmer at planetvearcity – a place where programmers come to learn, build, and grow.

Welcome to the new tutorial series on shell scripting. In this video, we will be covering the introduction of shell scripting and write a hello world script.

Before we begin. I recommend you guys to watch my Linux command line tutorial. I have posted the link in the description. That tutorial is a prerequisite to this tutorial series. Moving along I will assume you understand basic Linux commands.

The shell script is a computer program designed to be run by the Unix/Linux.

There many different types of the shell such as:

  1. The Bourne Shell
  2. The C shell
  3. The Korne Shell
  4. The Bourne-Again shell


13 | less command

Linux Command Line Tutorial


In this video, we will learn how to use less command. less is a command-line utility that displays the content of a file or a command output, one page at a time. The less command is mostly used for opening large files.

The general syntax for using less command is:

less [options] filename

It is also possible to use less with other commands output.

ls /etc | less

When opening a file that is too large to fit in one page, you will see the colon at the bottom of the screen. What makes less more appealing is its ease of file navigation.

Navigation Commands

CommandOutput
f or space barnext page
j, down key or enternext line
k or up keyprevious line
bprevious page
Gend of the file
gstart of the file
[n]Ggoes to nth line
/[pattern]top-down search
?[pattern]bottom-up search
nnext search result
Nprevious search result
Navigation commands

Options

OptionEffect
-Nshow line numbers
-Xpreserve screen content after exiting less
+Fwatch out for changes being made to the file
Options for less command

Thank you 🙂