Skip to content
Snippets Groups Projects
Commit 63c10ace authored by Mattijs Janssens's avatar Mattijs Janssens Committed by graham
Browse files

simplification of colouring

parent 2606d864
Branches
Tags
No related merge requests found
......@@ -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
# Set colour
colour=${colours[$colourIndex]}
## echo "** host=$host colourIndex=$colourIndex colour=$colour"
if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then
eval $* 2>&1 | colourPipe $colour
if [ "$WM_COLOURS" ]; then
# Set colour
colourString=`setterm -foreground ${colours[$colourIndex]}`
if [ "$host" = "$HOST" ]; then
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
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
retval=$?
else
if [ "$colour" ]; then
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe $colour
if [ "$host" = "$HOST" ]; then
eval $*
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd"
fi
retval=$?
fi
retval=$?
# Release lock
rm -f "$lockFile" 2>/dev/null
......
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