Bash:Mapfile
redirection 으로 array 변수에 값을 입력할 때 유용하다.
Example
function run_pytest
{
local find_dir=$1
local dirs=()
mapfile -t dirs < <(find "$find_dir" -mindepth 1 -maxdepth 1 -type d)
local file
for i in ${dirs[*]}; do
file=$i/pytest.sh
if [[ -x "$file" ]]; then
print_message "Run '$file' ..."
bash "$file"
fi
done
}
STORAGE_DIR=$CORE_DIR/storage
if [[ $SKIP_STORAGE -eq 0 ]]; then
run_pytest "$STORAGE_DIR/daemon"
run_pytest "$STORAGE_DIR/plugin"
fi