STYLE: use shell 'command' instead of 'which' in tutorials

This commit is contained in:
Mark Olesen 2017-07-07 16:00:57 +02:00
parent e7da4f0d07
commit 6afa62a6e4
11 changed files with 49 additions and 57 deletions

View File

@ -1,10 +1,9 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helveicta,20"

View File

@ -1,10 +1,10 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"

View File

@ -1,10 +1,10 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"

View File

@ -1,10 +1,10 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"

View File

@ -1,10 +1,10 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"

View File

@ -53,12 +53,11 @@ EOF
}
# test if gnuplot exists on the system
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
SETSDIRT="../postProcessing/thermoCouple"

View File

@ -85,20 +85,18 @@ EOF
echo "createGraphs:"
# test if gnuplot exists on the system
if ! which gnuplot > /dev/null 2>&1
then
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
SETSDIR="../postProcessing/sample"
if [ ! -d $SETSDIR ]
then
echo "FOAM FATAL ERROR: result sets not available in directory $SETSDIR" >&2
[ -d "$SETSDIR" ] || {
echo "FOAM FATAL ERROR: result sets not available in directory $SETSDIR" 1>&2
exit 1
fi
}
# paths to data
LATESTTIME=$(ls $SETSDIR)

View File

@ -30,28 +30,25 @@
# Joule heating case
#
#------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # Run from this directory
# Stop on first error
set -e
# test if gnuplot exists on the system
if ! which gnuplot > /dev/null 2>&1
then
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
echo "Creating graph"
OFDATA='postProcessing/sample1/solid/20000/centreLine_T_jouleHeatingSource:V_jouleHeatingSource:sigma.xy'
if [ ! -f "$OFDATA" ]
then
echo "FOAM FATAL ERROR: OpenFOAM results not available in $OFDATA" >&2
[ -f "$OFDATA" ] || {
echo "FOAM FATAL ERROR: OpenFOAM results not available in $OFDATA" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced

View File

@ -36,12 +36,11 @@ done
# create validation plot
# test if gnuplot exists on the system
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
graphName="OF_vs_ANALYTICAL.eps"

View File

@ -3,11 +3,11 @@
tail -n +4 ../postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > ../Numerical.dat
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"

View File

@ -1,10 +1,10 @@
#!/bin/sh
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
# Test if gnuplot exists on the system
command -v gnuplot >/dev/null 2>&1 || {
echo "gnuplot not found - skipping graph creation" 1>&2
exit 1
fi
}
gnuplot<<EOF
set term post enhanced color solid linewidth 2.0 20