
Text Processing
How to Use sed With Variables and Special Characters
Pass shell variables into sed safely: double quotes, another delimiter, escaping slash and ampersand, and when awk or perl is the cleaner tool.
6 min read
Tag
4 posts

Pass shell variables into sed safely: double quotes, another delimiter, escaping slash and ampersand, and when awk or perl is the cleaner tool.

Where environment variables leak secrets: child processes, /proc, logs, crash dumps, Docker inspect and CI output, and safer ways to pass configuration.

Pass shell variables into awk safely with -v and ENVIRON instead of splicing them into the program, and avoid quoting, escape-sequence and injection bugs.

Configure a shell script through environment variables, with prefixes, defaults, required-variable checks and the export rules that decide what children see.