How to Create Shell Script in Linux/Unix

Today, We will learn how to create shell scripts in Linux or UNIX systems. We will start with the basic concept of how shell scripts work and will also see the example. Read: Linux Shell script example 1 Shell Scripting is an open-source computer program designed to be run by the Unix/Linux shell. Shell Scripting is … Read more

Firewalls

Firewalls A machine connected to the Internet that isn’t behind a firewall is a disaster waiting to happen. And you won’t have to wait long. A recent study by the Internet Storm Center has shown that unpatched Windows computers only lasted 20 minutes before they were infected by some malware. If you’re running Linux, you’re … Read more

shell embedding and options

shell embedding Shells can be embedded on the command line, or in other words, the command line scan can spawn new processes containing a fork of the current shell. You can use variables to prove that new shells are created. In the screenshot below, the variable $var1 only exists in the (temporary) sub shell. You … Read more

commands and arguments(shell expansion)

arguments One of the primary features of a shell is to perform a command line scan. When you enter a command at the shell’s command prompt and press the enter key, then the shell will start scanning that line, cutting it up in arguments. While scanning the line, the shell may make many changes to … Read more

Use of Semicolons in Shell Script

shell programming

Use of Semicolons in Shell Script Instead of being on separate lines, statements can be separated by a semicolon (;) – For example: if grep “UNIX” myfile; then echo “Got it”; fi – This actually works anywhere in the shell. % cwd=`pwd`; cd $HOME; ls; cd $cwd  

Control Statements in Shell script

shell programming

Control Statements in Shell script Without control statements, execution within a shell scripts flows from one statement to the next in succession. Control statements control the flow of execution in a programming language The three most common types of control statements: – conditionals: if/then/else, case, … – loop statements: while, for, until, do, … – … Read more