mise au point fonction commandIsWorking
This commit is contained in:
16
functions.sh
16
functions.sh
@@ -68,8 +68,8 @@ fi
|
||||
#Ok if dir exists
|
||||
# arg1: dir to check
|
||||
function dirMustExists {
|
||||
if [ -d ${1} ] ; then echo -ne "1;"
|
||||
else echo -ne "0;"
|
||||
if [ -d ${1} ] ; then e 1
|
||||
else e 0
|
||||
fi
|
||||
}
|
||||
# Ok if given dir DOESNOT exists
|
||||
@@ -219,10 +219,16 @@ function processIsRunning {
|
||||
}
|
||||
|
||||
#Ok if given command returns 0
|
||||
# arg1: command to be run
|
||||
# arg1: chroot dir
|
||||
# arg2: command to be run
|
||||
function commandIsWorking {
|
||||
command=$1
|
||||
if ( $command &> /dev/null ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
||||
chroot=$1
|
||||
shift
|
||||
command="$@"
|
||||
chroot ${chroot} bash -c "$command" &> /dev/null
|
||||
ret=$?
|
||||
if [ $ret -eq 0 ] ; then e 1 ; else e 0 ; fi
|
||||
|
||||
}
|
||||
|
||||
# ok if given pattern is detected on command's stdout or stderr
|
||||
|
||||
Reference in New Issue
Block a user