facebook youtube pinterest twitter reddit whatsapp instagram

Bash Programming

Guides

awk In Bash Scripting

Mon, 19 OctBy DevsrealmGuy
Up until now, we have covered a couple of text processing, from sed to grep to sort, and now we have the big daddy, which is awk. awk (which stands for Aho, Weinberger, and Kernighan - its creators)
If you are tired of using control panels (I am because they are mostly not secure, and most comes loaded with bundles of useless stacks), and want to do everything on the server level, I wrote a menu
Sometimes we need to think like the command line shell in order to understand how things are done in the background, this would make debugging a breeze. In this guide, you would learn all the variou

Text Processing (Filters) In Bash Scripting

Sun, 20 SepBy DevsrealmGuy
Ever wondered if you could quickly do some text processing in a bash script, for example, you can analyze a text or sort the output of a text, and provide it in a more meaningful way. The good thing

Sort in Bash Scripting

Sun, 20 SepBy DevsrealmGuy
We recently just looked at grep in bash scripting, and another commonly used program in bash scripting is the program called sort. Sort is a simple filter that is used to sort lines of text from its

sed (Stream Editor) In Bash Scripting

Sun, 20 SepBy DevsrealmGuy
Another powerful filter in GNU/Linux is sed (stream editor), which is a program for performing basic editing tasks on the output of another program or on a file. sed or stream editor can be used to p

grep (Regular Expression) In Bash Scripting

Sun, 20 SepBy DevsrealmGuy
We recently discussed filters in bash scripting, in this guide we would look more into the practical usage of using a filter program, and an example of such a program is grep. grep, in its simplest f

Functions in Bash

Sat, 12 SepBy DevsrealmGuy
Functions are modular building blocks for creating powerful and modular scripts, using function makes it easy to isolate a code since it would be in a single building block, which would be isolated f

Returning Values From Functions in (Bash)

Sat, 12 SepBy DevsrealmGuy
In the guide function in bash, we dive deep in bash functions and we also pass some information into the functions to carry out a certain operation. In this guide, I'll show you how to get informatio

Using Case Statements in Bash

Sun, 06 SepBy DevsrealmGuy
We previously looked at looping in bash, and creating conditional statements using if and else but there are cases where using case statements makes the logic simpler, and clearer. This is the basic

Creating Multiple Menus in Bash Scripts

Sun, 06 SepBy DevsrealmGuy
I have been writing a couple of scripts now for different use cases, wouldn't it be handy to build a menu which will provide a list of command select to choose from? e.g It can contain all sorts of s
Out of frustration of the way different plugin optimizes images (which is super limited, and not effective; it has never been for me)in the WordPress world, I decided to create a script that does it

Iterating With Loops (Bash)

Sun, 30 AugBy DevsrealmGuy
Imagine having to edit 10,000 lines of text within a CSV file, this would be a shit load of work if done manually, which is where looping comes in. When a task or a series of tasks needs to be repeat
There are a couple of ways you can replace a string in a file, and an example is using the mv command, but what if you want to replace multiple strings at once, then you might consider creating a loo
We have recently explored command-line list, we also dived into the test shell builtin command, which can not only be used to check file types but can also be used to compare values. The issue with u

Test Shell Builtin Command

Thu, 20 AugBy DevsrealmGuy
The test command can be a shell builtin or file executable (if you specify the full path to the file) that is used for file comparison, it returns a status of 0 (true) or 1 (false) depending on the

Check If Variable Is Not Empty [isset] (Bash)

Thu, 20 AugBy DevsrealmGuy
In the getting started with bash guide, we took a sneak peek in customizing script with argument, the issue with the example is that we aren't checking if the variable is set or not before returning

Simple Conditional Execution With (Command Lists)

Thu, 20 AugBy DevsrealmGuy
We've previously explored a little of a command list in our Getting Started with Bash Guide, where we check if a directory already existed in our user home directory, if it already exists, output “

read prompts in bash script

Thu, 13 AugBy DevsrealmGuy
We've previously taken a quick look at the builtin read command, where we use the built-in read to populate the $REPLY variable, which holds the value of read when a variable is not supplied to read
Local variables are private inside of a function and the most important thing about a local variable is that when it is changed in a function, it doesn't affect the variable outside of a function. If