Autodidactics
Truncation 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 postEmbracing jq and JSON
Finding objects in a complex JSON structure isn't as scary as I thought with jq. My friend and colleague Rui was asking today about finding directory information for a given global account on SAP's...
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 postToday's TIL trio
Here are three mini TILs from today, on minimum JSON, using tee, and netstat options. I enjoy finding time to catch up on reading blog posts and watching videos in my queue, but the time is often...
read postSession switching with the tmux menu
Here's a way to get a simple session switcher in tmux using a popup menu. I was looking at Waylon Walker's tmux fzf session jumper recently, and really liked it, so much so that I dug into the...
read posttmux output formatting
Here's what I learned today about FORMATS in tmux output. This week I came across Waylon Walker who is doing some lovely learning-and-sharing on the topic of tmux, the terminal multiplexer. He has a...
read postReopening pull requests and GITHUB_ACTOR
Today I learned that the GITHUB_ACTOR on a re-opened pull request reflects the person re-opening it, not the original creator. Over on the Community Guidelines content for SAP's Open Documentation...
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 postNew tmux panes and windows in the right directory
I finally got round to looking into how to be in the "right" directory when I create a new window or pane in tmux. Here's what I did. I've been starting multiple tmux sessions, one for each...
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 postfzf - the basics part 2 - search results
Here’s more of what I learned from reading the first part of the fzf README and paying attention. Now I have a better setup and understanding of the basics and how to control the appearance, it's time...
read postfzf - the basics part 1 - layout
Here's what I learned from reading the first part of the fzf README and paying attention. Now I have a better setup and understanding of the basics, and in particular how to control the appearance. In...
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 postcurl and multipart/form-data
In reading through Mr Rob's ix script, I discovered something about curl that I hadn't known about. The script's key line is this: url=$(curl -s -F 'f:1=<-' http://ix.io) My gaze was immediately...
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 postYou can mask sensitive hostnames with wildcards and host aliases
The HOSTALIASES feature works well when combined with wildcard host definitions in SSH config I run my own DNS locally via Pi-hole, but I also like to have SSH configuration to specify various options...
read postThe open square bracket [ is an executable
In a shell script, the [ symbol is not syntax, it's an executable In my live stream episode this morning I added to a function so that it looked like this: getservicekey () { local instance=${1} ...
read postWhy we have /bin/ and /usr/bin/
There's a simple, historic reason why we have /bin/ and /usr/bin/ I'd half wondered for a while why many of the directories in the root filesystem (/) of a Linux installation are also to be found in...
read postString.prototype.replace() can take a function
You can use a function to dynamically provide the replacement value in a replace operation I was pondering different approaches to solving the Codewars kata Simple string reversal, and having...
read postcontinue-on-error can prevent a job step failure causing an action failure
Use continue-on-error: true in a GitHub Actions job spec to prevent failures from being flagged when a job step fails. For me, high (non-zero) return codes don't always necessarily denote failure;...
read postgit diff can emit different exit codes
You can combine git diff exit codes and the POSIX ! operator to control GitHub Actions job step execution based on git changes. When defining a job step in GitHub Actions, you can specify a condition...
read postIn an mta.yaml file you can use the service-name parameter to point to an existing resource
In mta.yaml files you can use the service-name parameter to point to an existing service instance with a different name than the resource. When the contents of a multi-target application file file...
read post