Bash
In this article I’m going to show you how to add a make help command to your makefiles that quickly and easily shows simple documentation for your commands:
To add the help command to your makefile, add a recipe like so:
.PHONY: help help: # Show help for each of the Makefile recipes. @grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done Now just make sure that each of your recipes has a comment that follows the recipe name, which will be used as its documentation.
Read more
I have rebuilt my “Effective Shell” series as an online book - it’s available now on:
https://effective-shell.com
The whole site is built from a GitHub repo at github.com/dwmkerr/effective-shell. It is open for contributions, changes, issues and suggestions. I’ve also added a comment section to each page to get input.
To keep the material as accessible as possible, I have added a new section for beginners, to help anyone who has not used a shell before.
Read more
In this chapter, we’ll take a look at the various different types of shell commands that exist and how this can affect your work.
By the end of this chapter, you might even be able to make sense of the horrifying and perfectly syntactically valid code below:
which $(where $(what $(whence $(whereis who)))) Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands What Are Commands?
Read more
Job control is a feature of most shells, which is generally not particularly intuitive to work with. However, knowing the basics can help prevent you from getting yourself into a tangle, and can from time to time make certain tasks a little easier.
In this chapter, we’ll look at the main features of job control, why it can be a problematic, and some alternatives.
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands What Is Job Control?
Read more
This is the first ‘interlude’ in my Effective Shell series. These interludes give some background, history or more flavour to some of the topics.
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands This one should be high-level enough for even non-technical readers to enjoy (or at least understand!
Read more
This is the fourth part of my Effective Shell series, a set of practical examples of ways to be more efficient with everyday tasks in the shell or at the command line.
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article we’ll look at the key elements of navigation in the shell.
Read more
This little bash snippet will let you open a GitHub or GitLab pull request from the command line on most Unix-like systems (OSX, Ubuntu, etc), without using any magic libraries, ZSH tricks or other dependencies.
tl;dr download the gpr.sh gist.
Here’s how it looks in action OSX:
And Ubuntu:
The script is available as the gpr.sh gist. You can also find it in my dotfiles, in the git.sh file.
The Script Here’s the script in its entirety:
Read more
This is the third part of my Effective Shell series - practical examples of ways to be more efficient with everyday tasks in a shell.
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article I’ll show you how to quickly get help when working with tools in the shell, without disrupting your flow!
Read more
This is the second part of my Effective Shell series, which contains practical tips for using the shell to help with every day tasks and be more efficient:
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands In this article I’ll show you how you can use the shell as an efficient tool to compliment how you use the clipboard.
Read more
This is the first part of a series I am writing which contains practical tips for using the shell more effectively.
Part 1: Navigating the Command Line Part 2: Become a Clipboard Gymnast Part 3: Getting Help Part 4: Moving Around Part 5: Interlude - Understanding the Shell Part 6: Everything You Don’t Need to Know About Job Control Part 7: The Subtleties of Shell Commands I can’t think of a better place to start than navigating the command line.
Read more