Search results
/postroll
Bash Strict Mode
redsymbol.net
I've known about the flags to make Bash behavior more strict or predictable, but this one adds an extra dimension for making iteration over strings more predictable as well. In a nutshell, strict mode is:
set -euo pipefail
IFS=$'\n\t'
Read the post for an excellent write-up of why each of these is important, and what each accomplishes.
/postroll
Prevent the Docker container from taking 10 seconds to stop
akrabat.com
Rob Allen details how the exec form of a Docker CMD is the better form to use. The reason the string form invokes bash first, and thus bash gets PID 1, which is what Docker will terminate when the container is terminated. The problem is that bash doesn't then send a termination signal to the actual process invoked, forcing the Docker host to wait 10 seconds before force killing all processes in the container.
From the blog
Posted 2023-12-13
Advent 2023: Makefile: guard targets
A couple days ago, I wrote about Makefile. Today, I'm going to show a quick tip for writing "guard" targets.
From the blog
Posted 2023-12-11
Advent 2023: Makefile
I like to automate common workflows when I can, particularly for web projects.
As an example, I may have different Docker Compose setups for development versus production, and having to remember to add the -f {compose file name}
argument can be tedious and error prone.
Being a long-time Linux user, I've used make
a lot, and am fairly comfortable with Makefile
, so I often turn to it for these tasks.
From the blog
Posted 2023-12-06
Advent 2023: MOTD on Ubuntu
I never intended for this Advent 2023 series to be a "Matthew's Bash Tips" series, but evidently, that's where things are going.
Today, I detail how to get the "message of the day" on Ubuntu
From the blog
Posted 2023-12-05
Advent 2023: Shellcheck
As you may have noted from previous posts in this Advent 2023 series, I find myself using Bash more and more often. This has certainly been a surprise for a career PHP developer, but it is what it is.
With PHP, there are a wealth of QA tools, from unit testing, to enforcing coding standards, to static analysis. What about with Bash? Well, the tools exist, and there's one I literally cannot write Bash without: Shellcheck.
From the blog
Posted 2023-12-04
Advent 2023: A deploy script
For the fourth day of 2023 advent blogging, I'm sharing a tool I've used to simplify deployment.
From the blog
Posted 2023-12-03
Advent 2023: Bashly
For the third day of my 2023 advent blogging, I'm covering a tool I've really leaned hard on the last few years: Bashly.
Search tips
- Use
#{some tag}
ortag:{some tag}
to filter by tag; using this more than once will find results that match all tags. - Use
year:{year}
to filter by year. If you use this multiple times, the last one wins. - Use
begin:{year-month-day}
to restrict to results beginning on that day. Last one wins. - Use
end:{year-month-day}
to restrict to results ending on that day. Last one wins.