Tag: shell script

Your Own Linux..! series on Linux / Unix Shell (Bash) Scripting

Your Own Linux..! recently published a multi-part series on Unix/Linux shell scripting, that would be useful to anyone desiring to write a bash script. The articles are:

Introduction – Linux / Unix Shell (Bash) Scripting

Bash Scripting Variables – Environment and Special Shell Variables

Bash Scripting – Arithmetic, Logical, Relational and Bitwise Operators

Bash Scripting – Arrays with Examples

Bash Scripting Conditionals – if-then-else, if-elif-else, Nested if-else

Bash Scripting – ‘for’ Loop

Bash Scripting – ‘while’ Loop

Bash Scripting – ‘case’ Statement

Bash Scripting – ‘select’ Loop and ‘select-case’ Statement

That’s the complete list as of the publication date of this post (EDIT: Plus a couple of late additions). If you want to check to see if any have been added since then, go here.

Linux/UNIX: Bash Read a File Line By Line

How do I read a file line by line under a Linux or UNIX-like system using KSH or BASH shell?

You can use while..do..done bash loop to read file line by line on a Linux, OSX, *BSD, or Unix-like system.

Source: Linux/UNIX: Bash Read a File Line By Line (nixCraft)

Link: Add tack e x on your bash shebang | #!/bin/bash -ex

Bash scripts can use various options on the shebang (#!/bin/bash). A more common one is: ‘#!/bin/bash -ex’ Here is the scoop!

Full article here:
Add tack e x on your bash shebang | #!/bin/bash -ex (scottlinux.com)

Link: Working with Arrays in Linux Shell Scripting – Part 8

We cannot imagine a programming language without the concept of arrays. It doesn’t matter how they are implemented among various languages. Instead arrays help us in consolidating data, similar or different, under one symbolic name.

Here as we are concerned about shell scripting, this article will help you in playing around with some shell scripts which make use of this concept of arrays.

Full article here:
Working with Arrays in Linux Shell Scripting – Part 8 (Tecmint)

Link: Understanding & Learning Basic Shell Scripting and Linux Filesystem Troubleshooting

The Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a brand new initiative whose purpose is to allow individuals everywhere (and anywhere) to get certified in basic to intermediate operational support for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus smart decision-making when it comes to raising issues to upper support teams.

…..

This is the last article (Part 10) of the present 10-tutorial long series. In this article we will focus on basic shell scripting and troubleshooting Linux file systems. Both topics are required for the LFCS certification exam.

Full article here:
Understanding & Learning Basic Shell Scripting and Linux Filesystem Troubleshooting – Part 10 (Tecmint)

Link: Backtick (`) symbol in Linux Shell Scripting

One of the most useful features of shell scripts is the lowly back quote character, usually called the backtick (`) in the Linux world. Be careful—this is not the normal single quotation mark character you are used to using for strings. Because it is not used very often outside of shell scripts, you may not even know where to find it on your keyboard. You should become familiar with it, because it’s a crucial component of many shell scripts.

Hint: On a U.S. keyboard, it is usually on the same key as the tilde symbol ( ∼ ).

The backtick allows you to assign the output of a shell command to a variable. While this doesn’t seem like much, it is a major building block in script programming. …..

Full article here:
Backtick (`) symbol in Linux Shell Scripting (NextStep4it)

Link: An Insight of Linux “Variables” in Shell Scripting Language

We already have written a series of articles on Linux Shell Scripting which was warm welcomed that time and it was much relevant even now. Here is the link to the collection of articles on shell scripting.

Here in this article we will see the variables, its execution and its implementation in shell script.

Full article here:
An Insight of Linux “Variables” in Shell Scripting Language – Part 9 (Tecmint)

Link: 25+ Awesome Linux/Unix command chaining examples

Today we will learn how to use different command chaining operators available for us in an easy way.

Command chaining operators

& –Sends process background (so we can run multiple process parallel)
; –Run multiple commands in one run, sequentially.
\ –To type larger command in multiple lines
&& –Logical AND operator
|| –Logical OR operator
! -NOT operator …
| — PIPE operator
{} –Command combination operator.
() –Precedence operator

Full article here:
25+ Awesome Linux/Unix command chaining examples (The Linux Juggernaut)

Link: Basic Linux Shell Scripting Language : ‘While’ Loops

In the previous article entitled “Basic Linux Shell Scripting Language : Introduction to ‘For’ Loops“, we have observed how a loop works. Loop is nothing but a control flow statement which executes a block of commands repeatedly till certain condition stays true, once the condition becomes false, the loop is terminated.

In this article, I will explain Basic syntax of ‘While’ loop along with some examples of ‘While’ loop usage. If you are new to Shell Scripting, I recommend that, you should read my article – Getting Started – Linux Shell Scripting Language.

One of the things we found interesting in this article is that it shows how to use an infinite ‘while’ loop that can only be broken out of by some specific event or condition. Very basic stuff, but something that can come in quite handy in certain situations.

Full article here:
Basic Linux Shell Scripting Language : ‘While’ Loops (Your Own Linux..!)

Link: Learning Shell Scripting Language: A Guide from Newbies to System Administrator

Linux is built with certain powerful tools, which are unavailable in Windows. One of such important tool is Shell Scripting. Windows however comes with such a tool but as usual it is much weak as compared to it’s Linux Counterpart. Shell scripting/programming makes it possible to execute command(s), piped to get desired output in order to automate day-to-day usages. In-fact automating these day-to-day task on server is an important task, system administrator has to perform and most of the admins achieve this by writing scripts to be executed as and when required.

…..

We have tried to cover a large variety of shell programming on a number of aspect in 5 different posts.

Full article here:
Learning Shell Scripting Language: A Guide from Newbies to System Administrator (TecMint)

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez