Commit e6dfb39c authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

STYLE: remove unnecessary stdout, stderr /dev/null redirects

- no stderr redirect needed:
    * 'command -v'

- no stdout/stderr redirect needed:
    * 'rm -f'

STYLE: consistent spacing after redirects
parent ec7e3c88
......@@ -186,7 +186,7 @@ std::string getLine(const std::string& filename, const std::string& addr)
+ "' -o '"
+ "target module load -f "
+ filename
+ " __TEXT 0x0' 2> /dev/null"
+ " __TEXT 0x0' 2>/dev/null"
+ " | grep LineEntry"
);
......
......@@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2015-2016 OpenFOAM Foundation
# Copyright (C) 2018 OpenCFD Ltd.
# Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -138,7 +138,7 @@ do
-webm)
# webm - needs avconv
outputFormat=webm
command -v avconv >/dev/null 2>&1 || \
command -v avconv >/dev/null || \
die "webm format requires avconv, which was not found."
;;
-*)
......@@ -168,7 +168,7 @@ echo
if [ "$outputFormat" = webm ]
then
if command -v avconv >/dev/null 2>&1
if command -v avconv >/dev/null
then
echo "Creating video with avconv..."
avconv \
......@@ -180,7 +180,7 @@ then
die "webm format requires avconv, which was not found."
fi
else
if command -v avconv >/dev/null 2>&1
if command -v avconv >/dev/null
then
echo "Creating video with avconv..."
avconv \
......@@ -189,7 +189,7 @@ else
-c:v libx264 -pix_fmt yuv420p \
"$outputPrefix.$outputFormat"
elif command -v mencoder >/dev/null 2>&1
elif command -v mencoder >/dev/null
then
echo "Creating video with mencoder..."
mencoder \
......
......@@ -241,7 +241,7 @@ reportExecutable()
| sed -ne 's/flex \([0-9][0-9.]*\).*/\1/p')
;;
wmake)
VERSION="$(wmake -show-api 2> /dev/null)"
VERSION="$(wmake -show-api 2>/dev/null)"
;;
*gcc* | *g++*)
VERSION=$($APP_NAME -v 2>&1 \
......
......@@ -296,7 +296,7 @@ say
# Generate Awk program
#-----------------------------
rm -f $AWKFILE 2> /dev/null
rm -f $AWKFILE
cat << AWK_CONTENTS > $AWKFILE
# Awk script for OpenFOAM log file extraction
BEGIN {
......
......@@ -226,7 +226,7 @@ proc*)
for i in processor*
do
(
cd "$i" 2> /dev/null && touch "${caseFile%.*}#${i#processor}.$extension"
cd "$i" 2>/dev/null && touch "${caseFile%.*}#${i#processor}.$extension"
)
done
echo "Created '$caseFile' for processor directories" 1>&2
......
......@@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2015-2018 OpenCFD Ltd.
# Copyright (C) 2015-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -27,14 +27,14 @@ cleanTimeDirectories()
while [ ${#zeros} -lt 8 ]
do
timeDir="0.${zeros}[1-9]*"
rm -rf ./${timeDir} ./-${timeDir} > /dev/null 2>&1
rm -rf ./${timeDir} ./-${timeDir}
zeros="0$zeros"
done
rm -rf \
./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* \
./.fxLock ./*.xml ./ParaView* ./paraFoam* \
./*.blockMesh ./*.foam ./*.OpenFOAM \
./.setSet > /dev/null 2>&1
./.setSet
}
......@@ -42,7 +42,7 @@ cleanAdiosOutput()
{
if [ -d adiosData ] && [ -d system ]
then
rm -rf adiosData > /dev/null 2>&1
rm -rf adiosData
fi
}
......@@ -51,7 +51,7 @@ cleanDynamicCode()
{
if [ -d dynamicCode ] && [ -d system ]
then
rm -rf dynamicCode > /dev/null 2>&1
rm -rf dynamicCode
fi
}
......@@ -63,23 +63,23 @@ cleanSnappyFiles()
constant/polyMesh/pointLevel \
constant/polyMesh/refinementHistory \
constant/polyMesh/level0Edge \
constant/polyMesh/surfaceIndex > /dev/null 2>&1
constant/polyMesh/surfaceIndex
rm -f \
processor*/constant/polyMesh/cellLevel \
processor*/constant/polyMesh/pointLevel \
processor*/constant/polyMesh/refinementHistory \
processor*/constant/polyMesh/level0Edge \
processor*/constant/polyMesh/surfaceIndex > /dev/null 2>&1
processor*/constant/polyMesh/surfaceIndex
rm -f \
constant/cellLevel \
constant/pointLevel \
0/cellLevel \
0/pointLevel > /dev/null 2>&1
0/pointLevel
rm -f \
processor*/constant/cellLevel \
processor*/constant/pointLevel \
processor*/0/cellLevel \
processor*/0/pointLevel > /dev/null 2>&1
processor*/0/pointLevel
}
......@@ -92,11 +92,11 @@ cleanOptimisation()
cleanPostProcessing()
{
rm -rf Ensight EnSight ensightWrite insitu VTK > /dev/null 2>&1
rm -rf postProcessing > /dev/null 2>&1
rm -rf postProcessing-dry-run > /dev/null 2>&1
rm -rf cuttingPlane > /dev/null 2>&1
rm -rf surfaceSampling > /dev/null 2>&1
rm -rf Ensight EnSight ensightWrite insitu VTK
rm -rf postProcessing
rm -rf postProcessing-*
rm -rf cuttingPlane
rm -rf surfaceSampling
}
......@@ -108,19 +108,19 @@ cleanCase()
cleanDynamicCode
cleanOptimisation
rm -rf processor* > /dev/null 2>&1
rm -rf TDAC > /dev/null 2>&1
rm -rf probes* > /dev/null 2>&1
rm -rf forces* > /dev/null 2>&1
rm -rf graphs* > /dev/null 2>&1
rm -rf sets > /dev/null 2>&1
rm -rf system/machines > /dev/null 2>&1
rm -rf processor*
rm -rf TDAC
rm -rf probes*
rm -rf forces*
rm -rf graphs*
rm -rf sets
rm -rf system/machines
# From mpirunDebug
rm -f gdbCommands mpirun.schema
cleanSnappyFiles
rm -f 0/cellDist > /dev/null 2>&1
rm -f 0/cellDist
(
cd constant 2>/dev/null || exit 0
......@@ -128,13 +128,13 @@ cleanCase()
rm -rf \
cellDecomposition cellToRegion cellLevel* pointLevel* \
tetDualMesh \
> /dev/null 2>&1
;
# Old constant/polyMesh location for blockMeshDict still in use?
# - emit a gentle warning
if [ -e polyMesh/blockMeshDict.m4 ]
then
rm -f polyMesh/blockMeshDict > /dev/null 2>&1
rm -f polyMesh/blockMeshDict
echo
echo "Warning: not removing constant/polyMesh/ "
echo " it contains a blockMeshDict, which should normally be under system/ instead"
......@@ -147,13 +147,13 @@ cleanCase()
echo
else
# Remove polyMesh entirely if there is no blockMeshDict
rm -rf polyMesh > /dev/null 2>&1
rm -rf polyMesh
fi
)
if [ -e system/blockMeshDict.m4 ]
then
rm -f system/blockMeshDict > /dev/null 2>&1
rm -f system/blockMeshDict
fi
}
......@@ -175,24 +175,22 @@ removeCase()
cleanSamples()
{
rm -rf sets samples sampleSurfaces > /dev/null 2>&1
rm -rf sets samples sampleSurfaces
}
cleanUcomponents()
{
rm -rf 0/Ux 0/Uy 0/Uz > /dev/null 2>&1
rm -rf 0/Ux 0/Uy 0/Uz
}
cleanFaMesh ()
{
(
cd constant/faMesh 2>/dev/null && \
rm -rf \
faceLabels* faBoundary* \
> /dev/null 2>&1 \
)
rm -rf \
constant/faMesh/faceLabels* \
constant/faMesh/faBoundary* \
;
}
......
......@@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017 OpenCFD Ltd.
# Copyright (C) 2017-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
......@@ -73,7 +73,7 @@ logReport()
collectLogs()
{
echo "Collecting log files..." 1>&2
rm -f logs testLoopReport > /dev/null 2>&1
rm -f logs testLoopReport
touch logs testLoopReport
local appDir log logFiles
......@@ -115,7 +115,7 @@ removeLogs()
-name '*.pvs' -o -name '*.foam' -o -name '*.OpenFOAM' \
\) -type f -delete
rm -f logs testLoopReport > /dev/null 2>&1
rm -f logs testLoopReport
}
......
......@@ -434,7 +434,7 @@ restore0Dir()
(
echo "Filter #include directives in processors/0:"
\cd processors/0 2>/dev/null || exit 0
for file in $(grep -l "#include" * 2> /dev/null)
for file in $(grep -l "#include" * 2>/dev/null)
do
foamDictionary "$file" > "$file.$$." && mv "$file.$$." "$file"
echo " $file"
......
......@@ -204,7 +204,7 @@ do
do
extractOptions $appName
done
elif command -v "$item" > /dev/null 2>&1
elif command -v "$item" >/dev/null
then
extractOptions $item
else
......
......@@ -128,7 +128,7 @@ then
[ -d "$outputDir" ] && [ -w "$outputDir" ] || \
die "Cannot write to $outputDir" "Not a directory, or no permission?"
else
mkdir -p "$outputDir" 2> /dev/null || \
mkdir -p "$outputDir" 2>/dev/null || \
die "Cannot create directory: $outputDir"
fi
......@@ -138,7 +138,7 @@ echo 1>&2
# Use a tmp file so that we confirm that the content was
# generated and looks somewhat like a manpage (has a SYNOPSIS)
tmpFile="$outputDir/${0##*/}-tmp$$"
trap "rm -fv $tmpFile >/dev/null; exit 0" EXIT TERM INT
trap "rm -fv $tmpFile 2>/dev/null; exit 0" EXIT TERM INT
# Any special filter requirements?
......@@ -148,12 +148,12 @@ outputExt="1"
case "$outputType" in
pdf)
outputExt="pdf"
command -v groff > /dev/null || die "Missing program: groff"
command -v ps2pdf > /dev/null || die "Missing program: ps2pdf"
command -v groff >/dev/null || die "Missing program: groff"
command -v ps2pdf >/dev/null || die "Missing program: ps2pdf"
;;
gz)
outputExt="1.gz"
command -v gzip > /dev/null || die "Missing program: gzip"
command -v gzip >/dev/null || die "Missing program: gzip"
;;
esac
......@@ -212,7 +212,7 @@ do
do
process $appName
done
elif command -v "$item" > /dev/null 2>&1
elif command -v "$item" >/dev/null
then
process $item
else
......
......@@ -113,8 +113,8 @@ done
rm -rf latex man
# Remove html directory in background
mv html html-stagedRemove$$ 2> /dev/null
rm -rf html-stagedRemove$$ >/dev/null 2>&1 &
mv html html-stagedRemove$$ 2>/dev/null
rm -rf html-stagedRemove$$ 2>/dev/null &
# Ensure that created files are readable by everyone
umask 22
......
......@@ -58,7 +58,7 @@ then
echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH" 1>&2
fi
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing (not makeCGAL)
if command -v _foamAddLibAuto >/dev/null # Normal sourcing (not makeCGAL)
then
_foamAddLibAuto $BOOST_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
_foamAddLibAuto $CGAL_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
......
......@@ -45,7 +45,7 @@ then
echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH" 1>&2
fi
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing (not makeFFTW)
if command -v _foamAddLibAuto >/dev/null # Normal sourcing (not makeFFTW)
then
_foamAddLibAuto $FFTW_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
......
......@@ -32,7 +32,7 @@ then
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2
fi
if command -v _foamAddLibAuto > /dev/null 2>&1
if command -v _foamAddLibAuto >/dev/null
then
# Normal sourcing (not makeAdios2)
# Only add to PATH if the directory really exists
......
......@@ -78,7 +78,7 @@ foamAddCompletion()
# echo "complete ${appName##*/}" 1>&2
done
elif command -v "$appName" > /dev/null 2>&1
elif command -v "$appName" >/dev/null
then
complete -o filenames -F _of_complete_ "${appName##*/}"
# echo "complete ${appName##*/}" 1>&2
......
......@@ -48,7 +48,7 @@ then
echo "Using gperftools ($gperftools_version) -> $GPERFTOOLS_ARCH_PATH" 1>&2
fi
if command -v _foamAddLib > /dev/null 2>&1 # Normal sourcing
if command -v _foamAddLib >/dev/null # Normal sourcing
then
# If GPERFTOOLS_ARCH_PATH does not end with '-system' or '-none',
......
......@@ -38,9 +38,9 @@ then
echo "Using hypre ($hypre_version) -> $HYPRE_ARCH_PATH" 1>&2
fi
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing (not makeHYPRE)
if command -v _foamAddLibAuto >/dev/null
then
# Normal sourcing (not makeHYPRE)
_foamAddLibAuto $HYPRE_ARCH_PATH
unset hypre_version
......
......@@ -82,7 +82,7 @@ OPENMPI)
fi
# Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
if command -v _foamAddLibAuto >/dev/null # Normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddMan $MPI_ARCH_PATH/share/man
......@@ -151,7 +151,7 @@ MPICH)
export MPI_HOME=$MPI_ARCH_PATH
# Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
if command -v _foamAddLibAuto >/dev/null # Normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddMan $MPI_ARCH_PATH/share/man
......@@ -175,7 +175,7 @@ MVA2MPI) # MVAMPICH2
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
if command -v _foamAddLibAuto >/dev/null # Normal sourcing
then
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddMan $MPI_ARCH_PATH/share/man
......@@ -341,7 +341,7 @@ esac
# Add (non-dummy) MPI implementation
# - dummy MPI already in lib-path and has no external libraries
if [ "$FOAM_MPI" != dummy ] && type _foamAddLib > /dev/null 2>&1
if [ "$FOAM_MPI" != dummy ] && command -v _foamAddLib >/dev/null
then
if [ -n "$FOAM_EXT_LIBBIN" ] # External libraries (allowed to be unset)
then
......
......@@ -201,7 +201,7 @@ esac
#------------------------------------------------------------------------------
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
if command -v _foamAddLib >/dev/null # normal sourcing
then
unset ParaView_VERSION ParaView_QT
fi
......
......@@ -85,7 +85,7 @@ fi
#------------------------------------------------------------------------------
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
if command -v _foamAddLib >/dev/null # normal sourcing
then
unset ParaView_VERSION
else
......
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