Quantcast
Channel: The Linux Terminal » Programming
Browsing all 13 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Introduction to IF – BASH programming

 Introduction to if General At times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. The if construction allows you to...

View Article



Image may be NSFW.
Clik here to view.

More advanced IF usage – BASH programming

More advanced if usage if/then/else constructs Dummy example This is the construct to use to take one course of action if the if commands test true, and another if it tests false. An example: freddy...

View Article

Image may be NSFW.
Clik here to view.

The CASE statement – BASH programming

Using case statements Simplified conditions Nested if statements might be nice, but as soon as you are confronted with a couple of different possible actions to take, they tend to confuse. For the more...

View Article

Image may be NSFW.
Clik here to view.

Introduction to FUNCTIONS and examples – Bash programming

Introduction to Functions What are functions? Shell functions are a way to group commands for later execution, using a single name for this group, or routine. The name of the routine must be unique...

View Article

Image may be NSFW.
Clik here to view.

Introduction to sed – StreamEditor – BASH programming

Introduction to sed What is sed? A Stream EDitor is used to perform basic transformations on text read from a file or a pipe. The result is sent to standard output. The syntax for the sed command has...

View Article


Image may be NSFW.
Clik here to view.

Interactive editing with SED – BASH programming

Interactive editing with SED Printing lines containing a pattern This is something you can do with grep, of course, but you can’t do a “find and replace” using that command. This is just to get you...

View Article

Image may be NSFW.
Clik here to view.

Non-interactive editing with SED – BASH programming

Non-interactive editing with SED Reading sed commands from a file Multiple sed commands can be put in a file and executed using the -f option. When creating such a file, make sure that: No trailing...

View Article

Image may be NSFW.
Clik here to view.

Introduction to GAWK – BASH programming

Getting started with gawk What is gawk? Gawk is the GNU version of the commonly available UNIX awk program, another popular stream editor. Since the awk program is often just a link to gawk, we will...

View Article


Image may be NSFW.
Clik here to view.

Programming with AWK – BASH programming

The print program Printing selected fields The print command in awk outputs selected data from the input file. When awk reads a line of a file, it divides the line in fields based on the specified...

View Article


Image may be NSFW.
Clik here to view.

Gawk variables – BASH programming

Gawk variables As awk is processing the input file, it uses several variables. Some are editable, some are read-only. The input field separator The field separator, which is either a single character...

View Article

Image may be NSFW.
Clik here to view.

BASH programming – all about redirection

All about redirection Theory and quick reference There are 3 file descriptors, stdin, stdout and stderr (std=standard). Basically you can: redirect stdout to a file redirect stderr to a file redirect...

View Article

Image may be NSFW.
Clik here to view.

BASH programming – Loops for, while and until

Loops for, while and until In this section you’ll find for, while and until loops. The for loop is a little bit different from other programming languages. Basically, it let’s you iterate over a series...

View Article

Image may be NSFW.
Clik here to view.

15 Unix tricks

15 Unix tricks The Unix command line provides numerous ways to make our work easier. Here are 15 “tricks” that I use often to make quick work of various tasks Display the last word in every line of a...

View Article

Browsing all 13 articles
Browse latest View live




Latest Images