Created
October 2, 2023 14:59
-
-
Save pravynandas/94628a7e398acaca3dacf0a307e9a45d to your computer and use it in GitHub Desktop.
Read csv string into a variable as an array and loop through each element (removing extra spaces).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=, | |
str="Item1, Item2" | |
read -ra LIST <<<"$str" | |
for i in "${LIST[@]}"; do echo "$i" | xargs; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment