728x90
반응형
## Sort an Array In Bash
array=('1' '3' '2' 'a' 'a3' 'a2' 'a4')
IFS=$'\n' sorted=($(sort <<<"${array[*]}")); unset IFS
echo ${sorted[@]}
반응형
## Sort an Array In Bash
array=('1' '3' '2' 'a' 'a3' 'a2' 'a4')
IFS=$'\n' sorted=($(sort <<<"${array[*]}")); unset IFS
echo ${sorted[@]}