Handling First-Class Lists in Shell Scripting: Solutions with jq and es Shell
By
alurm
The bagel they save for the regulars. Don't skim, savour.
Summary
The article discusses the limitations of common shells in handling first-class lists and proposes solutions, such as using tools like 'jq' and the 'es shell'. It provides a practical example of implementing a function to split arguments by a double dash ('--'), a common format in command-line utilities.
Key quotes
· 4 pulledIt’s not a secret that most common shells don’t have first class lists.
As a more practical example of this, let’s implement split-by-double-dash, a function (or a program) that would return two lists: args that come before -- and ones that come after.
There are a couple of options for returning lists in shell scripting.
The challenge lies in efficiently managing lists in shell environments.
You might also wanna read
pu.sh: A lightweight coding-agent harness in 400 lines of shell script
A minimal coding-agent harness called "pu.sh" built in just 400 lines of shell script. It requires no package managers (npm, pip) or Docker
pu.dev·1mo agoauge: A Terminal-Based OCR and Vision Analysis Tool with On-Device Processing
auge is a command-line tool that provides Apple Vision-like OCR, classification, barcode detection, and face recognition capabilities direct
cheat.sh Command-Line Tool Documentation and Usage
The article appears to be a technical documentation or cheat sheet for the cheat.sh service, which is a command-line tool for accessing prog
Understanding sandbox-exec: macOS's Built-in Command-Line Sandboxing Utility
The article introduces sandbox-exec, a built-in macOS command-line utility that allows users to run applications in a sandboxed environment
Perlin-Terminal: Terminal-Based Perlin Noise Animation Tool
Perlin-terminal is a command-line tool that creates beautiful Perlin noise animations in the terminal using 24-bit truecolor and half-block
Offpunk 3.0 Released: Command-Line Browser for Web, Gemini, and Gopher with Offline Capabilities
Offpunk 3.0 has been released as a major update to the command-line Web, Gemini, and Gopher browser that enables offline work. The developer
