Created
June 4, 2024 19:41
-
-
Save loplex/921f4f694a97e4fea3ad97b9bfed297d to your computer and use it in GitHub Desktop.
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 | |
function sampleImput() { | |
printf "%s\0" 'a b' 'c d' | |
} | |
# using read: | |
unset arrA i; while IFS= read -r -d '' 'arrA[i++]'; do :; done < <(sampleImput) | |
declare -p arrA i | |
# using readarray: | |
unset arrB; IFS= readarray -d '' arrB < <(sampleImput) | |
declare -p arrB | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment