Skip to content
Snippets Groups Projects
Commit 0178d726 authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

simplification of colouring

parent e684296b
No related branches found
No related tags found
No related merge requests found
...@@ -137,16 +137,6 @@ done ...@@ -137,16 +137,6 @@ done
# is returned and not of colouring pipe. # is returned and not of colouring pipe.
set -o pipefail 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 colourIndex=0
while : while :
...@@ -164,26 +154,28 @@ do ...@@ -164,26 +154,28 @@ do
do do
lockFile="$lockDir/$host:$i" lockFile="$lockDir/$host:$i"
if lockfile -r0 "$lockFile" 2>/dev/null; then if lockfile -r0 "$lockFile" 2>/dev/null; then
# Set colour if [ "$WM_COLOURS" ]; then
colour=${colours[$colourIndex]} # Set colour
## echo "** host=$host colourIndex=$colourIndex colour=$colour" colourString=`setterm -foreground ${colours[$colourIndex]}`
if [ "$host" = "$HOST" ]; then if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then eval $* 2>&1 | sed -e "s/^/$colourString/"
eval $* 2>&1 | colourPipe $colour elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else else
eval $* ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | sed -e "s/^/$colourString/"
fi fi
elif [ -n "$JOB_ID" ]; then retval=$?
qrsh -inherit -v PWD $host "$rcmd"
else else
if [ "$colour" ]; then if [ "$host" = "$HOST" ]; then
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe $colour eval $*
elif [ -n "$JOB_ID" ]; then
qrsh -inherit -v PWD $host "$rcmd"
else else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd"
fi fi
retval=$?
fi fi
retval=$?
# Release lock # Release lock
rm -f "$lockFile" 2>/dev/null rm -f "$lockFile" 2>/dev/null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment