All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Handling First-Class Lists in Shell Scripting: Solutions with jq and es Shell

By

alurm

9mo ago· 7 min readen

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 pulled
It’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.
Snippet from the RSS feed
More shell tricks: first class lists, jq, and the es shell

You might also wanna read