this post was submitted on 05 Mar 2025
1569 points (99.0% liked)
Programmer Humor
21016 readers
1332 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
There actually is an array in any POSIX shell. You get one array per file/function. It just feels bad to use it. You can abuse 'set -- 1 2 3 4' to act as a proper array. You can then use 'for' without 'in' to iterate over it.
for i; do echo $i; done.
Use shift to pop items off.
If I really have to use something more complex, I'll reach for mkfifo instead so I can guarantee the data can only be consumed once without manipulating entries.
Cool, good to know.