Array in Bash

I have written a hand full of Bash scripts, but none of those utilized array. Why? It’s because of two main things: 1. I don’t know how to use array in Bash, and 2. I would normally switch to write the script in Python instead. Today, however, I need to update an existing script written in Bash to make use of array. This was a perfect excuse for me to spend some 30 minutes to learn about array in Bash....

October 18, 2023 · 2 min · 221 words · Kenno

bash: append_path: command not found

I have a few Raspberry Pi at home, they’re used for specific purposes such as Kodi media player, Pi-hole server, and a backup DNS/DHCP server. Recently, I need to turn on the backup DNS/DHCP server, which is one of the Raspberry Pi devices running Arch Linux. When I logged into to the server, I saw a message complaining that bash: append_path: command not found. It’s been so long since this little server, so I can’t remember what happened last time....

December 9, 2021 · 3 min · 596 words · kenno

Looping Through Line in a File in Bash

I wanted to install vim package on FreeBSD 13.0, and did so without realizing that there were over 86 additional dependency packages installed. This was done with pkg install -y vim command. Anyway, I wanted to clean up by removing vim and those dependencies after all this is a headless server. Removing vim package doesn’t remove the installed dependencies. Fortunately, I was able to copy and paste the names of dependency packages and save it to a file....

April 17, 2021 · 2 min · 226 words · kenno

How to Create Multiple Directories with Incrementing Numbers in Names

I need to create 20 empty directores with the following name: dvd01, dvd02, dvd03,…, dvd20. My first thought was to use for loop, but then I decided to do a quick Google search, and found something more elegant: $ mkdir dvd{01..20} That’s cool, isn’t it? Reference: How to create multiple directories with incrementing numbers in a single command?

June 9, 2020 · 1 min · 58 words · kenno