Split String und Array Bash erstellen
my_array=($(echo $string | tr "," "\n"))
Prickly Pheasant
my_array=($(echo $string | tr "," "\n"))
string="you got a friend in me"
IFS=' ' read -ra split <<< "$string"
echo "${split[*]}"
# Output: you got a friend in me
echo "${split[3]}"
# Output: friend
IN="[email protected];[email protected]"
arrIN=(${IN//;/ })
echo ${arrIN[1]} # Output: [email protected]
IN="[email protected];[email protected]"
arrIN=(${IN//;/ })
IFS=', ' read -r -a array <<< "$string"
IFS='|' read -r -a arrayName <<< "$variable"