Custom Bash Builtins in C: Lessons From awie-bash
Writing Bash builtins in C: the .def format, compiling into bash vs enable -f, what my old awie-bash code got wrong, and a tested loadable port with timings.
Topic
Writing Bash builtins in C: the .def format, compiling into bash vs enable -f, what my old awie-bash code got wrong, and a tested loadable port with timings.
Temp files and stale locks left behind by failed scripts are avoidable. Tested trap patterns for EXIT, INT, TERM and ERR, plus mkdir and flock locks.
Why I convert os.system() calls to subprocess.run(): no shell injection, real exit codes, captured output, timeouts and input, with notes for Python 3.6.
"Address already in use" again? How to find the owner of a port with ss, lsof and fuser, decode /proc/net/tcp by hand, and why some ports show no process.
Find processes by their full command line in pure Bash by reading /proc/PID/cmdline, with the NUL bytes handled properly and the 2009 bugs fixed.
Run a command silently and test only its exit status. Why "$@" beats storing a command in a string, and what to use for pipelines.