Commit 2e6f9014 by walkerning Committed by Stéphane Graber

Check if stdout is a terminal in lxc-checkconfig

Let lxc-checkconfig write to non-tty stdout without color control characters Signed-off-by: 's avatarwalkerning <foxdoraame@gmail.com>
parent 5a537be5
......@@ -6,10 +6,17 @@
CAT="cat"
SETCOLOR_SUCCESS="printf \\033[1;32m"
SETCOLOR_FAILURE="printf \\033[1;31m"
SETCOLOR_WARNING="printf \\033[1;33m"
SETCOLOR_NORMAL="printf \\033[0;39m"
if [ -t 1 ]; then
SETCOLOR_SUCCESS="printf \\033[1;32m"
SETCOLOR_FAILURE="printf \\033[1;31m"
SETCOLOR_WARNING="printf \\033[1;33m"
SETCOLOR_NORMAL="printf \\033[0;39m"
else
SETCOLOR_SUCCESS=":"
SETCOLOR_FAILURE=":"
SETCOLOR_WARNING=":"
SETCOLOR_NORMAL=":"
fi
is_set() {
$CAT $CONFIG | grep "$1=[y|m]" > /dev/null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment