Home » Shell Scripting » BASH

BASH

Effective Bash scripting for software developers

I’ve been asked many times about my shell scripts and things I’ve automated, as I’ve recently shown in a video about things I’ve automated on my system. I’ve created another video on how to effectively write Bash scripts for regular developers, who aren’t experienced on the sysadmin side of things. First and foremost, I wouldn’t consider myself a shell scripting ...

Read More »

Oh-my-bash MacOSX iTerm and stuff

I decided to up my command line game, so this a ‘remember how to do stuff‘ post for me. I do acknowledge that there are tons of different ways on doing things, especially when you have to deal with the command line. So don’t shoot the pianist. Step 0: I do use brewUse brew to manage a lot of command ...

Read More »

Some bash functions for git

Here some git related functions in my .bachrc. Is mostly a backup for me, but it might also be useful for someone else. Cloning a git repo Because I usually clone repos from my github account, this is a shortcut that allows me to just type clone *repo_name* and it will create the URL. function clone { if [ $# ...

Read More »

Writing safe(r) bash scripts

After writing more and more bash scripts for a client, I’ve decided to write down my thoughts about it. This assumes you have some knowledge about bash, as it is not intended as a beginner’s tutorial. Why bash scripts? Bash is present in almost every unix/linux-based stack, now some Windows as well. An exception is the ‘alpine’ docker images, which ...

Read More »

Bash If-Then-Else Example

This is a Bash If-Then-Else Example. Sometimes 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 specify such conditions.                   The following table shows an overview of the whole article: Table ...

Read More »

Bash If – Statement Example

This is an If – Condition Example. Sometimes 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 specify such conditions.                   The most compact syntax of the if command is: if ...

Read More »

Linux Bash awk Example

This is an awk tutorial. The basic function of awk is to search files for lines or other text units containing one or more patterns. When a line matches one of the patterns, special actions are performed on that line. Programs in awk are different from programs in most other languages, because awk programs are “data-driven”. You describe the data ...

Read More »

A Sed (Stream Editor) Example

This is a Sed (Stream Editor) example. 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 no output file specification, but results can be saved to a file using output redirection. The editor does not modify the ...

Read More »

Bash Regular Expressions Example

A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions by using various operators to combine smaller expressions.                     The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular ...

Read More »