Home » Shell Scripting

Shell Scripting

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 »

Increasing Shell Productivity With Zsh Aliases

The zsh shell, such as many others, supports aliases to minimize the amount of typing required. Beside simple command aliases, zsh comes with a multitude of extended alias features. Normal, or command aliases are very helpful for commands that you keep typing all over again. How often do you type git status, mvn clean install, or docker build yourself, manually? ...

Read More »

PowerShell Tutorial (Especially for People Who Hate PowerShell)

My relationship with the terminal—especially Windows PowerShell—has been a bit of a roller coaster. I first discovered the terminal when I heard about Python and didn’t know anything about anything. Like the average person who uses computers for games and applications like Excel and PowerPoint, I went to the site, downloaded the installer, installed it, and clicked the icon. Imagine ...

Read More »

Asciidoctor: Creating a macro

I’ve been writing the TWIN4j blog for almost a year now and during that time I’ve written a few different asciidoc macros to avoid repetition. The most recent one I wrote does the formatting around the Featured Community Member of the Week. I call it like this from the asciidoc, passing in the name of the person and a link ...

Read More »

Asciidoc to Asciidoc: Exploding includes

One of my favourite features in AsciiDoc is the ability to include other files, but when using lots of includes is that it becomes difficult to read the whole document unless you convert it to one of the supported backends. $ asciidoctor --help Usage: asciidoctor [OPTION]... FILE... Translate the AsciiDoc source FILE or FILE(s) into the backend output format (e.g., ...

Read More »

Let’s Talk About Shell Scripting

Bash is a command-line shell now available on all major operating systems, and it is the environment from which most developers can accomplish the majority of tasks for a system. Many of the commands that need to be executed to complete a task can be grouped together in a script to help avoid repetition when typing the commands. Furthermore, there’s ...

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 »