|
@@ -14,14 +14,30 @@ the following command:
|
|
|
|
|
|
#
|
|
#
|
|
# Set a few variables that influence the text that's printed on the
|
|
# Set a few variables that influence the text that's printed on the
|
|
-# screen. The SET_COL variable starts the text in column number 70 (as
|
|
|
|
-# defined by the COL variable). NORMAL prints text in normal mode.
|
|
|
|
|
|
+# screen. The SET_COL variable starts the text in the column number
|
|
|
|
+# decided by the COL and WCOL section (as defined by the COL
|
|
|
|
+# variable). NORMAL prints text in normal mode.
|
|
# SUCCESS prints text in a green colour and FAILURE prints text in a red
|
|
# SUCCESS prints text in a green colour and FAILURE prints text in a red
|
|
# colour
|
|
# colour
|
|
#
|
|
#
|
|
|
|
|
|
-COL=70
|
|
|
|
-WCOL=50
|
|
|
|
|
|
+# If COLUMNS hasn't been set yet (bash sets it but not when called as
|
|
|
|
+# sh), do it ourself
|
|
|
|
+
|
|
|
|
+ if [ -z "$COLUMNS" ]
|
|
|
|
+ then
|
|
|
|
+ # Get the console device if we don't have it already
|
|
|
|
+ test -z "$CONSOLE" && CONSOLE=/dev/console
|
|
|
|
+
|
|
|
|
+ # Get the console size (rows columns)
|
|
|
|
+ SIZE=$(stty size < $CONSOLE)
|
|
|
|
+
|
|
|
|
+ # Strip off the rows leaving the columns
|
|
|
|
+ COLUMNS=${SIZE#*\ }
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+COL=$[$COLUMNS - 10]
|
|
|
|
+WCOL=$[$COLUMNS - 30]
|
|
SET_COL="echo -en \\033[${COL}G"
|
|
SET_COL="echo -en \\033[${COL}G"
|
|
SET_WCOL="echo -en \\033[${WCOL}G"
|
|
SET_WCOL="echo -en \\033[${WCOL}G"
|
|
NORMAL="echo -en \\033[0;39m"
|
|
NORMAL="echo -en \\033[0;39m"
|