ENH:foamJob: handling of quotes (from Mantis)
This commit is contained in:
parent
a7799adeb8
commit
a5ebecbd3a
40
bin/foamJob
40
bin/foamJob
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -50,6 +50,28 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#for being able to echo strings that have single quotes
|
||||||
|
echoArgs() {
|
||||||
|
addSpace=""
|
||||||
|
|
||||||
|
for stringItem in "$@"; do
|
||||||
|
|
||||||
|
echo -n "${addSpace}"
|
||||||
|
|
||||||
|
if [ "${stringItem##* }" = "$stringItem" ]
|
||||||
|
then
|
||||||
|
echo -n "$stringItem"
|
||||||
|
addSpace=" "
|
||||||
|
else
|
||||||
|
echo -n "'$stringItem'"
|
||||||
|
addSpace=" "
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
unset stringItem addSpace
|
||||||
|
}
|
||||||
|
|
||||||
unset version
|
unset version
|
||||||
|
|
||||||
# replacement for possibly buggy 'which'
|
# replacement for possibly buggy 'which'
|
||||||
@ -217,11 +239,11 @@ then
|
|||||||
#
|
#
|
||||||
if [ "$screenOpt" = true ]
|
if [ "$screenOpt" = true ]
|
||||||
then
|
then
|
||||||
echo "Executing: $mpirun $mpiopts $APPLICATION $@ -parallel | tee log"
|
echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel | tee log"
|
||||||
$mpirun $mpiopts $APPLICATION $@ -parallel | tee log
|
$mpirun $mpiopts $APPLICATION "$@" -parallel | tee log
|
||||||
else
|
else
|
||||||
echo "Executing: $mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1"
|
echo "Executing: $mpirun $mpiopts $APPLICATION $(echoArgs "$@") -parallel > log 2>&1"
|
||||||
$mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1 &
|
$mpirun $mpiopts $APPLICATION "$@" -parallel > log 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -230,12 +252,12 @@ else
|
|||||||
#
|
#
|
||||||
if [ "$screenOpt" = true ]
|
if [ "$screenOpt" = true ]
|
||||||
then
|
then
|
||||||
echo "Executing: $APPLICATION $@ | tee log &"
|
echo "Executing: $APPLICATION $(echoArgs "$@") | tee log &"
|
||||||
$APPLICATION $@ | tee log &
|
$APPLICATION "$@" | tee log &
|
||||||
wait $!
|
wait $!
|
||||||
else
|
else
|
||||||
echo "Executing: $APPLICATION $@ > log 2>&1 &"
|
echo "Executing: $APPLICATION $(echoArgs "$@") > log 2>&1 &"
|
||||||
$APPLICATION $@ > log 2>&1 &
|
$APPLICATION "$@" > log 2>&1 &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user