function commandOutput

This commit is contained in:
2022-11-02 22:00:03 +01:00
parent d4c6cd5eb8
commit 670e749451

View File

@@ -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 {