I've got a string like this:8080 ac ac df asd 9019 f v adfs 1 123 da 123xIs there a clever way to convert this into arrays like this using Bash?8080 ac ac df asd9019 f v adfs1 123 da 123x
Bash convert string to array of strings?
bash;text processing
# define functionfoo() { while [ -n $2 ]; do array+=( \$1\ \$2\ ); shift 2; done; }# call function with stringfoo 8080 ac ac df asd 9019 f v adfs 1 123 da 123x# print arrayprintf %s\n ${array[@]}Output:8080 ac ac df asd9019 f v adfs1 123 da 123x