diff --git a/general_utils b/general_utils index 2cc0133..ae8dcfe 100755 --- a/general_utils +++ b/general_utils @@ -1,4 +1,4 @@ -#!/bin/bash +#! /bin/bash - # set -x source ./log_helpers @@ -34,12 +34,13 @@ if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once local ps_pid=$! # remember pid of process substitution local __result="" + while read __tmp <&$fd; do if ! [ -z "$__tmp" ]; then - __result="${__result}$__tmp" + __result+=" $__tmp" fi done - + exec {fd}>&- # close fd (i.e. process substitution) wait $ps_pid # wait for the subshell to finish @@ -49,6 +50,7 @@ if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once printf '%s' "$__result" return $__result_code } + # exec_process_substitution 'opkg --noaction list' usage () { echo "Usage: $PROGRAM [--file config] [--?] [--help] [--version] [--dbg]"