Shell
New source for LXD images on Crostini
I recently wanted to create a second Debian-based container in the Linux context of one of my ChromeOS devices. But I found I couldn't, as the image wasn't available any more. This post is a short...
read postUsing lazydocker with SSH-based remote contexts
A quick hack to work around the current issue with lazydocker and SSH-based remote Docker context definitions. I've used the excellent lazydocker before, but only occasionally, reverting to the docker...
read postObtaining auth code grant type OAuth 2.0 tokens for Google APIs with a script
I wanted to programmatically append rows to a Google Spreadsheet recently. For this I needed to use the spreadsheets.values.append method in the Sheets API v4. The API resources are protected, and...
read postA simple jq REPL with tmux, bash, vim and entr
In this quick post I show a simple JSON dataset explorer that gives me a multi-line filter editor. When it comes to exploring and processing JSON data, jq is my goto language. And for exploring, I...
read postImproving my interactive jq workflow with ijq, bash and tmux
I'm a big fan of ijq and how it allows me to explore JSON data interactively with jq expressions. With a small script I have improved my workflow by being able to capture the jq expression from ijq...
read postBash notes 3
Another Exercism Bash track exercise, another opportunity to learn from the community solutions. This time I came across a few nice Bash language features that I'd probably known about but forgotten...
read postA classic example of yak shaving, and some stream editing
It's not often that I'm relaxed enough to be aware of how my mind is (or isn't) working, and what it's doing. So it was a surprise when I realised that what I've been doing for the past 15 minutes is...
read postBash notes 2
I looked at a couple of more solutions to another Exercism exercise in the Bash track - Scrabble Score. I was reminded of one particular feature of the case statement, and another solution was rather...
read postBash notes
Here are a few things I learned, or re-learned, while reading through a neat solution to a Bash track exercise in Exercism. I completed a very basic solution to the Proverb exercise in the Bash track...
read postExercism and jq
I wanted to see how a jq track might work in Exercism. Here's what I tried out this morning. Exercism is a great resource for learning and practising languages. I've dabbled in a couple of tracks and...
read postTruncation and neat terminal output
I learned about the psFormat Docker configuration option recently, and it got me thinking about how I strive for neat terminal output. I'm unashamedly a fan of the terminal, of the command line...
read postControlling Chrome from the CLI
Here's how I used the chrome-cli tool to help me open up URLs in different tabs in a new Chrome window. From the command line. In analysing various GitHub issues and pull requests recently, I needed...
read postExploring fff part 2 - get_ls_colors
Continuing to read and learn from the source code to fff - this time, the getls_colors function. In part 1 I took a first look at fff, "a simple file manager written in Bash", focusing on...
read postSourcing vs executing in Bash
Checking the value of $0 allows me to source rather than execute an entire script. Today I wrote a script checksubmissions to check submitted pull requests in the SAP-samples/devtoberfest-2021 repo...
read postUsing functions more
Using functions more in my shell seems to bring benefits. Here's an example. Bash functions seem to sit in a sweet spot between aliases and full blown scripts. I've defined a number of functions in...
read postImproving shell fu with practice
Practising in the shell helps me improve and exposes me to new knowledge. Here's an example. At the end of the working day I'm tired, but there's often just enough energy left in my brain to explore...
read postExploring fff part 1 - main
Here's what I learned from starting to read the source code to fff - in particular, the main function. fff is "a simple file manager written in Bash". As I'm always on the lookout to learn...
read postLearning by rewriting - bash, jq and fzf details
One of the ways I learn is by reading and sometimes rewriting other people's scripts. Here I learn more about jq by rewriting a friend's password CLI script. My friend Christian Drumm published a nice...
read postUnix tooling - join, don't extend
Reading a paper from 1984 has helped crystallise an important axiom in Unix tool design, so much so that I found myself referring to it today when scripting. Rob Pike and Brian Kernighan authored a...
read postEarly thoughts on Warp
Here are some very early thoughts on Warp, the "pro terminal designed for everyday use". Today I was pointed in Warp's direction on Twitter by Christian Pfisterer and Christian Drumm. To...
read postUnpacking Bash shell tips from a GitHub Actions workflow
Someone shared a GitHub Actions workflow step which was written to find out some pull request info, but I thought even the first couple of shell lines, using IFS and awk, were worth staring at for a...
read postProducing JSON with jq for appending issue titles
I learned how to use jq to produce JSON, while writing a script to enhance my Thinking Aloud journal entry titles. In my Thinking Aloud journal, the entries are issues in a GitHub repository. To...
read postTwo-phase video uploads with YouTube API and curl
TIL how to use the YouTube API to upload a video, with curl, using a two-phase approach. I'm becoming more familiar with the YouTube API surface area, and a task recently required me to look into an...
read postMass deletion of GitHub Actions workflow runs
Implementing a simple cleanup script for workflow runs, using gh, jq, fzf and the GitHub API Yesterday, while thinking aloud, I was wondering how best to mass-delete logs from GitHub Actions workflow...
read postAborting a script with parameter expansion
Use the :? form of shell parameter expansion to abort a script if a required parameter value is not set. I'm attracted to the somewhat arcane details of Bash shell expansions and it was while looking...
read postWaiting for jobs, and the concept of the shell
Bash's 'wait' builtin helps me understand Bash scripting as a language I was browsing the source code of the main script in the bash-http-monitoring project that had been shared on a social news site...
read postImplicit values in Bash for loop construct
Bash's 'for loop' construct can use implicit values - who knew? Not me ... I was browsing a Superuser question and answer this morning and the code in the accepted answer looked like this: set --...
read postCase modification operators in parameter substitution
Today I learned that in addition to the usual ways of uppercasing strings, Bash 4 brought the addition of case modification operators to the parameter substitution family. Spending a pleasant coffee...
read postMID$ and shell parameter expansion
While perhaps misunderstood and potentially confusing due to the different options, the ability to access and manipulate values in variables in Bash is rich and varied. I've just set up Exercism on...
read postUnderstanding declare
I've been looking into declare, and also how it compares to typeset and local. It turns out that there's a lot to know. After working my way through the small ix script in Mr Rob's dotfiles, writing...
read postDesnowballification with set -o errexit
I've started to use set -o errexit at the start of my scripts to make them more robust. There comes a time when you move from just hacking lines of shell script together into a file, to recognising...
read postChecking a command is available before use
There's one final nugget in Mr Rob's ix script that I wanted to pick out. It's not earth shattering but still useful to have seen. At the end of the script, the URL generated from the newly created...
read postUsing exec to jump
In Mr Rob's dotfiles repo (see A new learning source for shell scripting) there's a treasure trove of content that is very pleasant to peruse. In one of his streams I saw him use ix and thereby...
read postShell parameter expansion with :+ is useful
Use the shell parameter expansion form :+ for expanding optional values I've been increasing my Bash scripting activities recently, not least in relation to some live stream episodes relating to...
read post