diff --git a/functions.sh b/functions.sh index c64c299..d3ca1ef 100755 --- a/functions.sh +++ b/functions.sh @@ -276,6 +276,18 @@ function commandIsWorking { } +# return latest line of commande output +# arg1: chroot dir +# arg2: command to be run +function commandOutput { + chroot=$1 + shift + command="$@" + result=$(chroot ${chroot} bash -c "$command" 2> /dev/null) + ret=$? + if [ $ret -eq 0 ] ; then e ${result:=0} ; else e 0 ; fi + } + # get num of files in given dir # arg1: dir function numFilesInDir {