function commandOutput
This commit is contained in:
12
functions.sh
12
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
|
# get num of files in given dir
|
||||||
# arg1: dir
|
# arg1: dir
|
||||||
function numFilesInDir {
|
function numFilesInDir {
|
||||||
|
|||||||
Reference in New Issue
Block a user