From 0de6fe44143647adacb3cdf89ada93e1ebf79443 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 20 Aug 2024 21:56:20 +0100 Subject: [PATCH] Add daily email for 2024-08-19 Bash scripting for fun (and profit?) --- source/_daily_emails/2024-08-19.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 source/_daily_emails/2024-08-19.md diff --git a/source/_daily_emails/2024-08-19.md b/source/_daily_emails/2024-08-19.md new file mode 100644 index 000000000..c7d999de9 --- /dev/null +++ b/source/_daily_emails/2024-08-19.md @@ -0,0 +1,30 @@ +--- +title: Bash scripting for fun (and profit?) +date: 2024-08-19 +permalink: daily/2024/08/19/bash-scripting-for-fun-and-profit +tags: + - software-development + - linux +cta: ~ +snippet: | + Solving problems with Bash scripts. +--- + +As well as PHP, JavaScript, HTML, CSS, etc, I write a lot of Bash scripts. + +From [project-specific run files][0] 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][1]. + +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. + +[0]: {{site.url}}/daily/2022/08/15/using-run-file-simplify-project-tasks +[1]: https://github.com/opdavies/dotfiles.nix/blob/a1ef2d1402c9c607e7a3e4427ce125d0cabeddcd/lib/shared/scripts/export-video-list.nix#L12-L31