mise au point command stdout
This commit is contained in:
11
functions.sh
11
functions.sh
@@ -232,13 +232,16 @@ function commandIsWorking {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ok if given pattern is detected on command's stdout or stderr
|
# ok if given pattern is detected on command's stdout or stderr
|
||||||
# arg1: command
|
# arg1: chroot
|
||||||
# arg2: pattern
|
# arg2: command
|
||||||
|
# arg3: pattern
|
||||||
function commandStdoutPattern {
|
function commandStdoutPattern {
|
||||||
command=$1
|
chroot=$1
|
||||||
|
command=$2
|
||||||
shift
|
shift
|
||||||
pattern=$@
|
pattern=$@
|
||||||
if ( $command 2>&1 | grep -qiE "${pattern}" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
result=$(chroot ${chroot} bash -c "$command")
|
||||||
|
if ( echo -n "$result" | grep -qiE "${pattern}" ) ; then echo -ne "1;" ; else echo -ne "0;" ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ok if given service is enabled
|
# ok if given service is enabled
|
||||||
|
|||||||
Reference in New Issue
Block a user