Array functions
Laurent Lyaudet <[email protected]> Fri, 17 Apr 2026 17:22:48 +0200
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <CAB1LBmuwjz1Oh0eb+whK2ZGQSFx2AiZ5eHBr0qNZo7O8O3h=Fg@mail.gmail.com> |
Hello :),
Bash arrays are not directly compatible with commands,
hence array functions would need to be in Bash builtins instead of
external executables.
I think the length and the variety of solutions to simple questions
like this one:
https://stackoverflow.com/questions/2312762/compare-difference-of-two-arrays-in-bash
shows that it would be needed to add a builtin like
```
declare -a base_array=("a" b" "c" "d")
declare -a subtracted_array=("a "c")
declare -a result_array
array_diff base_array subtracted_array result_array
```
array functions from PHP could be a good source of inspiration for
other functions:
https://www.php.net/manual/en/ref.array.php
Best regards,
Laurent Lyaudet