Shell exec: Replacing a Process Without Spawning Another Wrapper
How the shell exec builtin replaces its process, preserves PID and selected descriptors, changes signal and trap behavior, and simplifies service wrappers.
tag
17 posts
How the shell exec builtin replaces its process, preserves PID and selected descriptors, changes signal and trap behavior, and simplifies service wrappers.
How Bash mapfile preserves complete records in indexed arrays, handles delimiters and descriptors, appends safely, and avoids pipeline subshell loss.
Why compinit checks ownership and permissions in fpath, how compaudit exposes unsafe completion trees, and how to repair them without bypass flags.
How bracketed paste wraps pasted bytes, how line editors use the markers, where trust ends, and how terminal programs enable, parse, disable, and test it.
A control-flow model for shell errexit covering tested commands, lists, pipelines, functions, subshells, command substitutions, traps, and explicit errors.
A precise model of shell file descriptors, left-to-right redirection, duplication versus paths, grouping, pipelines, persistent descriptors, and safe logging.
A recovery and prevention guide for broken terminal state: blind reset commands, stty inspection, TTY targeting, job control, exact restoration, and traps.
A POSIX getopts pattern covering OPTIND, OPTARG, leading-colon diagnostics, required operands, repeated calls, function scope, and portable limitations.
A rigorous guide to shell here-document parsing, quoted delimiters, expansion, tab stripping, indentation, remote commands, and safer data handling.
A bounded shell concurrency pattern covering background PIDs, wait status, failure aggregation, cleanup, signal forwarding, logs, and POSIX versus Bash features.
A threat-aware shell temporary-file pattern covering private directories, mktemp portability, permissions, traps, atomic replacement, signals, and cleanup.
A byte-accurate comparison of POSIX printf and echo covering option ambiguity, backslashes, format-string safety, arbitrary values, locales, and NUL limits.
A systems-level guide to POSIX terminal input processing, canonical and noncanonical reads, echo, signals, control characters, job control, and restoration.
The clever reload-from-disk trick that let DOS's COMMAND.COM recover automatically after a large program overwrote its expendable transient portion.
Use Haiku Terminal, Bash profiles and native filesystem tools safely, write portable scripts, and separate POSIX habits from Linux assumptions.
An operational account of Catalina's zsh default: which accounts changed, what stayed on Bash, and how administrators could migrate without breaking scripts.
Terminal and shell are separate programs linked by a kernel pty: one renders characters and handles input, the other interprets commands.