importpw / array

Array helper functions for shell scripts

Home Page:https://import.pw/array

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

array

Array helper functions for shell scripting.

API

array_join $separator $one [… $two]

Joins an array or set of passed arguments with $separator. Similar to JavaScript's Array#join().

#!/usr/bin/env import
import array

arr=(1 2 3)
array_join , "${arr[@]}"

array_split $separator $str

Splits a string based on an array or set of passed arguments with $separator. Similar to JavaScript's Array#split().

#!/usr/bin/env import
import array

printf "foo,bar,baz" | while array_split , part; do
  echo "$part"
done

About

Array helper functions for shell scripts

https://import.pw/array

License:MIT License


Languages

Language:Shell 88.6%Language:Dockerfile 11.4%