3 ms·
Reposting my comment from earlier: I once created a bash pipeline debugger that preserves the intermediate outputs. Has a few limitations but maybe generally us
by ketanmaheshwari 3y ago
Reposting my comment from earlier: I once created a bash pipeline debugger that preserves the intermediate outputs. Has a few limitations but maybe generally useful: https://github.com/ketancmaheshwari/pd https://github.com/ketancmaheshwari/pd
- parentheses 3y agoThis is really useful! Some ideas: Use single quotes in all your examples in the docs. '$1' doesn't expand but "$1" does. Also, if you can create a zsh function that can be mapped to a key like Alt-P (for analyze pipelines), then treat the entire line like a string and pass it to `pd`. Or, you could have it wrap and escape the command by editing the command line: `NEW_COMMAND="pd $(printf '%q' "$BUFFER")"` This also solves for mixed use of quotes like single and double quotes. Once I discovered it, I used it in all my scripts for treating strings in bash properly.