rawiriblundell / sh_libpath

Making shell scripts more robust with libraries
Apache License 2.0
11 stars 2 forks source link

Add 'list' commands to map python style "lists" to bash/ksh/zsh arrays. #19

Open rawiriblundell opened 2 years ago

rawiriblundell commented 2 years ago

I've seen a number of posts from pythonistas lately where they have struggled to mentally map python lists to bash arrays e.g.

LIST_OF_ENVIRONMENTS=[dev, prod, test...]

We could add some helper functions to meet them in the middle e.g.

readlist dev, prod, test            # builds ${LIST[@]}, similar to readarray/mapfile defaulting to ${MAPFILE[@]}
readlist -n mylist dev, prod, test  # builds ${mylist[@]}