Tags » shell scripting
-
Whose code am I running in GitHub Actions?
I wanted to know what third-party code I was using in my GitHub Actions. I was able to use standard text processing tools and shell pipelines to get a quick tally.
-
TIL: Debugging some confusing behaviour with
find
andxargs
Use the
--verbose
flag to see whatxargs
is doing; don’t rely onfind
to return files in a consistent order. -
TIL: Use
$_
to get the last argument to the previous bash commandThis allows you to write commands like
mkdir myfolder && cd $_
orgit init myrepo && cd $_
. -
TIL: The
open
command can ask questionsIf you pass an argument that can’t be easily identified as a file or a URL,
open
will ask you what to do next. This may be a surprise if you were trying to use it in a script. -
TIL: Use the
-n
/-i
flags to avoid overwriting files withcp
andmv
-
TIL: Using
errexit
and arithmetic expressions in bash -
TIL: Add the
-v
flag to see whatrm
is deleting -
TIL: Create a directory before you
cp
ormv
a file to it -
Making the fish shell more forgetful
A few commands that help me keep unwanted entries out of my shell’s autocomplete.
-
Starting Docker just before I need it
I don’t keep Docker running all the time, but intercepting the
docker
command means it’s always running when I need it. -
Checking lots of URLs with curl
A bash script to check the HTTP status code of a bunch of URLs, for simple and portable uptime checking.
-
How to do parallel downloads with youtube-dl
-
Finding the latest screenshot in macOS Mojave
-
TIL: How to use xargs for parallel processing
-
A shell alias for tallying data
A way to count records on the command-line.
-
Safely deleting a file called ‘-rf *’
If for some reason you create a file called
-rf *
, it’s possible to delete it safely. But really, don’t create it in the first place. -
Pretty printing JSON and XML in the shell
-
Quick shell access for Docker containers
A Bash function for quickly getting shell access to Docker containers.
-
Useful Bash features: exit traps