Commit 63c10ace authored by Mattijs Janssens's avatar Mattijs Janssens Committed by graham
Browse files

simplification of colouring

parent 2606d864
......@@ -137,16 +137,6 @@ done
# is returned and not of colouring pipe.
set -o pipefail
# Define function to colour output by argument 1
colourPipe(){
if [ "$1" ]; then
(while read line; do setterm -foreground $1; echo "$line" ; done; setterm -foreground default)
else
cat
fi
}
colourIndex=0
while :
......@@ -164,26 +154,28 @@ do
do
lockFile="$lockDir/$host:$i"
if lockfile -r0 "$lockFile" 2>/dev/null; then
if [ "$WM_COLOURS" ]; then
# Set colour
colour=${colours[$colourIndex]}
## echo "** host=$host colourIndex=$colourIndex colour=$colour"
colourString=`setterm -foreground ${colours[$colourIndex]}`
if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then
eval $* 2>&1 | colourPipe $colour
eval $* 2>&1 | sed -e "s/^/$colourString/"
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else
eval $*
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | sed -e "s/^/$colourString/"
fi
retval=$?
else
if [ "$host" = "$HOST" ]; then
eval $*
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else
if [ "$colour" ]; then
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe $colour
else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd"
fi
fi
retval=$?
fi
# Release lock
rm -f "$lockFile" 2>/dev/null
......
Supports Markdown
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