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
This commit is contained in:
Mark Olesen
2019-11-06 10:44:36 +01:00
committed by Andrew Heather
parent ec7e3c88e4
commit e6dfb39c66
131 changed files with 281 additions and 282 deletions

View File

@ -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 \

View File

@ -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 \

View File

@ -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 {

View File

@ -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

View File

@ -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* \
;
}

View File

@ -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
}

View File

@ -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"

View 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

View File

@ -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