This commit is contained in:
Peter 2015-12-09 12:34:53 +00:00
commit f373bc36a1
3 changed files with 24 additions and 5 deletions

View file

@ -58,4 +58,10 @@ cd docker-bench-security
sh docker-bench-security.sh sh docker-bench-security.sh
``` ```
Coloured output may be switched off to ease parsing:
```sh
sh docker-bench-security.sh -n |& grep '^\[WARN\]'
```
This script was build to be POSIX 2004 compliant, so it should be portable across any Unix platform. This script was build to be POSIX 2004 compliant, so it should be portable across any Unix platform.

View file

@ -37,6 +37,7 @@ usage () {
cat <<EOF cat <<EOF
usage: ${myname} [options] usage: ${myname} [options]
-n optional Don't colourise results
-h optional Print this help message -h optional Print this help message
-l PATH optional Log output in PATH -l PATH optional Log output in PATH
EOF EOF

View file

@ -1,9 +1,21 @@
#!/bin/sh #!/bin/sh
bldred='\033[1;31m' getopts n opts
bldgrn='\033[1;32m' case "$opts" in
bldblu='\033[1;34m' n)
bldylw='\033[1;33m' # Yellow bldred=
txtrst='\033[0m' bldgrn=
bldblu=
bldylw=
txtrst=
;;
*)
bldred='\033[1;31m'
bldgrn='\033[1;32m'
bldblu='\033[1;34m'
bldylw='\033[1;33m' # Yellow
txtrst='\033[0m'
;;
esac
logit () { logit () {
printf "%b\n" "$1" | tee -a "$logger" printf "%b\n" "$1" | tee -a "$logger"