Bash scripting for fun (and profit?)

As well as PHP, JavaScript, HTML, CSS, etc, I write a lot of Bash scripts.

From project-specific run files to CI pipelines, Dockerfiles and deployment scripts, Bash is used a lot in the ops side of software development.

Today, though, I wrote a small Bash script for my personal laptop.

I store an archive of video files on an external hard drive of conference talks, courses, tutorials or live streams that I want to keep or rewatch, and found that I've sometimes downloaded the same videos more than once, with the same files on my laptop and hard drive.

A few days ago, I was watching a video that I thought I'd save, but wasn't sure if I already had, so this script dumps the contents of my hard drive into a JSON file that I can easily browse or search through to see if I already have a video archived.

The script is fairly simple and uses tree and jq to display and format the data before saving it to a file on my laptop.

When I need to update the file, I plug in the hard drive and run it again.

A simple problem, and not something related to a particular project, but something I was able to solve with a Bash script.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.