diff --git a/bin/foamCreateVideo b/bin/foamCreateVideo
index c5c4abeb97..6fb419bbc3 100755
--- a/bin/foamCreateVideo
+++ b/bin/foamCreateVideo
@@ -33,7 +33,7 @@
# Input defaults
dirName='.'
-prefix='image'
+prefix='image.'
inputMask='%04d' # (avconv only)
unset startNumber # (avconv only)
@@ -52,24 +52,22 @@ usage () {
Usage: ${0##*/} [OPTIONS] ...
options:
- -d | -dir
input directory with png images (default: '.')
- -f | -fps frames per second (default = 10)
- -i | -image prefix for input image sequence (default: 'image')
- -o | -out name of output video file (default: 'video')
- -start start frame number (avconv only)
+ -d | -dir input directory with png images (default: '.')
+ -f | -fps frames per second (default: 10)
+ -i | -image input image sequence prefix (default: 'image.')
+ -o | -out output video name (default: 'video')
+ -mask input mask width for avconv (default: 4)
+ -start start frame number for avconv
-webm WebM output video file format (avconv only)
- -mask input mask width (avconv only, default: 4)
-h | -help help
Creates a video file from a sequence of PNG images.
-For example, image.0000.png, image.0001.png, ...
-
-- Can use -i/-image to specify other values. Eg, -i "pressure_" ...
-- The output format is MPEG-4
+With the default prefix ('image.'), from image.0000.png, image.0001.png, ...
+- The output format is MPEG4
- The output name (with mp4 format), is "video.mp4"
- By default the video codec is high resolution
-MPEG-4 output requires avconv or mencoder.
+MPEG4 output requires avconv or mencoder.
WebM output requires avconv.
USAGE
@@ -118,8 +116,8 @@ do
shift
;;
-mask)
- [ "$#" -ge 2 ] || die "'-out' requires an argument"
- digits="$(( $2 + 0))"
+ [ "$#" -ge 2 ] || die "'-mask' requires an argument"
+ digits="$(( $2 + 0 ))"
if [ "$digits" -gt 0 ]
then
inputMask="%0${digits}d"
@@ -152,16 +150,6 @@ done
#------------------------------------------------------------------------------
-# Add trailing '.' to the prefix if it does not already end with [-._]
-case "$prefix" in
- *[-_.])
- : # OK, use prefix as it is
- ;;
- (*)
- prefix="$prefix."
- ;;
-esac
-
# See how many files exist
nFiles="$(\ls $dirName/$prefix*.png 2>/dev/null | wc -l)"
@@ -182,7 +170,7 @@ then
echo "Creating video with avconv..."
avconv \
-framerate $frameRate $startNumber \
- -i "${dirName}/${prefix}$inputMask.png" \
+ -i "$dirName/$prefix$inputMask.png" \
-c:v libvpx -crf 15 -b:v 1M \
"$outputPrefix.$outputFormat"
else
@@ -194,7 +182,7 @@ else
echo "Creating video with avconv..."
avconv \
-framerate $frameRate $startNumber \
- -i "${dirName}/${prefix}$inputMask.png" \
+ -i "$dirName/$prefix$inputMask.png" \
-c:v libx264 -pix_fmt yuv420p \
"$outputPrefix.$outputFormat"
diff --git a/bin/foamExec b/bin/foamExec
index cb6bd4496a..85b20547e1 100755
--- a/bin/foamExec
+++ b/bin/foamExec
@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
-# \\/ M anipulation |
+# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@@ -38,10 +38,10 @@
# \endcode
#
# Note
-# This script must exist in $FOAM_INST_DIR/OpenFOAM-/bin/
-# or $FOAM_INST_DIR/openfoam/bin/ (for the debian version)
+# This script must exist in $WM_PROJECT_INST_DIR/OpenFOAM-/bin
+# or $WM_PROJECT_INST_DIR/openfoam/bin (debian)
#
-# foamEtcFile must be found in the same directory as this script
+# foamEtcFile located in the same directory as this script
#
# See also
# foamEtcFile
@@ -57,7 +57,7 @@ Usage: ${0##*/} [OPTION] ...
options:
-mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix
- pass through to foamEtcFile and set as FOAM_INST_DIR
+ pass through to foamEtcFile
-version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
pass through to foamEtcFile
-help Print the usage
@@ -71,11 +71,9 @@ USAGE
#-------------------------------------------------------------------------------
binDir="${0%/*}" # The bin dir
projectDir="${binDir%/bin}" # The project dir
-prefixDir="${projectDir%/*}" # The prefix dir (same as $WM_PROJECT_INST_DIR)
+# prefixDir="${projectDir%/*}" # The prefix dir (same as $WM_PROJECT_INST_DIR)
-## projectDirName="${projectDir##*/}" # The project directory name
-
-version="${WM_PROJECT_VERSION:-unknown}"
+projectVersion="${WM_PROJECT_VERSION:-unknown}"
unset etcOpts
# parse options
@@ -90,11 +88,10 @@ do
;;
-prefix=/*)
etcOpts="$etcOpts $1" # pass-thru to foamEtcFile
- prefixDir="${1#*=}"
;;
-version=*)
etcOpts="$etcOpts $1" # pass-thru to foamEtcFile
- version="${1#*=}"
+ projectVersion="${1#*=}" # for reporting
;;
-m | -mode)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
@@ -104,13 +101,12 @@ do
-p | -prefix)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
- prefixDir="$2"
shift
;;
-v | -version)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
- version="$2"
+ projectVersion="$2" # for reporting
shift
;;
--)
@@ -127,27 +123,23 @@ do
shift
done
-#
-# Find and source OpenFOAM settings (bashrc)
+
+# Find and source the OpenFOAM
# placed in function to preserve command-line arguments
-#
-sourceRc()
+sourceBashrc()
{
rcFile="$($binDir/foamEtcFile $etcOpts bashrc)" || {
- echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
- exit 1
+ echo "Error: bashrc file could not be found for OpenFOAM-$projectVersion" 1>&2
+ exit 2
}
- # set to consistent value before sourcing the bashrc
- export FOAM_INST_DIR="$prefixDir"
-
. $rcFile $FOAM_SETTINGS
}
[ "$#" -ge 1 ] || usage "no application specified"
-sourceRc
+sourceBashrc
exec "$@"
#------------------------------------------------------------------------------
diff --git a/bin/foamJob b/bin/foamJob
index 802122e9de..8ec2dfae0a 100755
--- a/bin/foamJob
+++ b/bin/foamJob
@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
-# \\/ M anipulation |
+# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@@ -42,7 +42,7 @@ options:
-screen also sends output to screen
-append append to log file instead of overwriting it
-wait wait for execution to complete (when not using -screen)
- -version specify an alternative OpenFOAM version
+ -version=VER specify an alternative OpenFOAM version
-help print the usage
* run an OpenFOAM job in background.
@@ -56,8 +56,8 @@ USAGE
echoArgs() {
addSpace=""
- for stringItem in "$@"; do
-
+ for stringItem in "$@"
+ do
echo -n "${addSpace}"
if [ "${stringItem##* }" = "$stringItem" ]
@@ -68,13 +68,11 @@ echoArgs() {
echo -n "'$stringItem'"
addSpace=" "
fi
-
done
unset stringItem addSpace
}
-unset version
# Replacement for possibly buggy 'which'
findExec() {
@@ -111,81 +109,79 @@ findExec() {
# Main script
#~~~~~~~~~~~~
unset parallelOpt screenOpt waitOpt
-
+unset projectVersion
# Parse options
while [ "$#" -gt 0 ]
do
- case "$1" in
- -h | -help*)
- usage
- ;;
- -case)
- [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
- cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
- shift 2
- ;;
- -p | -parallel)
- parallelOpt=true
- shift
- ;;
- -s | -screen)
- screenOpt=true
- shift
- ;;
- -a | -append)
- appendOpt=true
- shift
- ;;
- -w | -wait)
- waitOpt=true
- shift
- ;;
- -v | -version)
- [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
- version="$2"
- shift 2
- ;;
- --)
- shift
- break
- ;;
- -*)
- usage "invalid option '$1'"
- ;;
- *)
- break
- ;;
- esac
+ case "$1" in
+ -h | -help*)
+ usage
+ ;;
+ -case)
+ [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+ cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
+ shift
+ ;;
+ -p | -parallel)
+ parallelOpt=true
+ ;;
+ -s | -screen)
+ screenOpt=true
+ ;;
+ -a | -append)
+ appendOpt=true
+ ;;
+ -w | -wait)
+ waitOpt=true
+ ;;
+ -version=*)
+ projectVersion="${1#*=}" # for foamExec
+ ;;
+ -v | -version)
+ [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+ projectVersion="$2" # for foamExec
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ usage "invalid option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
done
+# ------------------------------------------------------------------------------
+
[ "$#" -ge 1 ] || usage "No application specified"
+# The requested application
+appName="$1"
# Use foamExec for a specified version
# Also need foamExec for remote (parallel) runs
-if [ -n "$version" -o "$parallelOpt" = true ]
+if [ -n "$projectVersion" -o "$parallelOpt" = true ]
then
# When possible, determine if application even exists
- if [ -z "$version" ]
+ if [ -z "$projectVersion" ]
then
- findExec $1 >/dev/null || usage "Application '$1' not found"
+ findExec "$appName" >/dev/null || usage "Application '$appName' not found"
fi
# Use foamExec for dispatching
- APPLICATION=`findExec foamExec` || usage "'foamExec' not found"
+ APPLICATION=$(findExec foamExec) || usage "'foamExec' not found"
- [ -n "$version" ] && APPLICATION="$APPLICATION -version $version"
-
- # Attempt to preserve the installation directory 'FOAM_INST_DIR'
- if [ -d "$FOAM_INST_DIR" ]
- then
- APPLICATION="$APPLICATION -prefix $FOAM_INST_DIR"
- fi
+ [ -n "$projectVersion" ] && APPLICATION="$APPLICATION -version $projectVersion"
else
- APPLICATION=`findExec $1` || usage "Application '$1' not found"
- echo "Application : $1"
+ APPLICATION=$(findExec "$appName") || usage "Application '$appName' not found"
+ echo "Application : $appName"
shift
fi
@@ -200,7 +196,7 @@ then
#
if [ -r "processor0" -o -r "processors" ]
then
- NPROCS="$(foamDictionary -entry numberOfSubdomains -value system/decomposeParDict)"
+ nprocs="$(foamDictionary -entry numberOfSubdomains -value system/decomposeParDict 2>/dev/null)"
else
echo "Case is not currently decomposed"
if [ -r system/decomposeParDict ]
@@ -218,16 +214,16 @@ then
#
# Find mpirun
#
- mpirun=`findExec mpirun` || usage "'mpirun' not found"
- mpiopts="-np $NPROCS"
+ mpirun=$(findExec mpirun) || usage "'mpirun' not found"
+ mpiopts="-np $nprocs"
#
# Check if the machine ready to run parallel
#
- echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
+ echo "Parallel processing using $WM_MPLIB with $nprocs processors"
case "$WM_MPLIB" in
*OPENMPI)
- # add hostfile info
+ # Add hostfile info
for hostfile in \
hostfile \
machines \
@@ -242,12 +238,9 @@ then
fi
done
- #
# Send FOAM_SETTINGS to parallel processes, so that the proper
# definitions are sent as well.
- #
mpiopts="$mpiopts -x FOAM_SETTINGS"
-
;;
esac
diff --git a/bin/mpirunDebug b/bin/mpirunDebug
index d92858d9bf..249dfbf60b 100755
--- a/bin/mpirunDebug
+++ b/bin/mpirunDebug
@@ -191,6 +191,8 @@ then
fi
+sourceFoam=false # Fallback command
+
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/
# check /etc/
@@ -210,18 +212,16 @@ then
done
fi
-# Construct test string for remote execution.
# Source OpenFOAM settings if OpenFOAM environment not set.
-# attempt to preserve the installation directory 'FOAM_INST_DIR'
# use FOAM_SETTINGS to pass command-line settings
-if [ -n "$FOAM_INST_DIR" ]
-then
- sourceFoam="FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
-else
- sourceFoam=". $sourceFoam $FOAM_SETTINGS"
-fi
-echo "**sourceFoam:$sourceFoam"
+case "$sourceFoam" in
+*/bashrc)
+ sourceFoam=". $sourceFoam $FOAM_SETTINGS"
+ ;;
+esac
+
+echo "**sourceFoam: $sourceFoam"
rm -f $PWD/mpirun.schema
touch $PWD/mpirun.schema
diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths
index 126489bf9b..b99f37986b 100755
--- a/bin/tools/foamConfigurePaths
+++ b/bin/tools/foamConfigurePaths
@@ -181,7 +181,7 @@ do
-foamInstall | --foamInstall)
# Replace FOAM_INST_DIR=...
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
- foamInstDir="$2"
+ prefixDir="$2"
_inlineSed \
etc/bashrc \
'\(.*BASH_SOURCE.*\)' \
@@ -195,8 +195,8 @@ do
_inlineSed \
etc/bashrc \
'^ *FOAM_INST_DIR=.*' \
- 'FOAM_INST_DIR='"$foamInstDir" \
- "Setting FOAM_INST_DIR to '$foamInstDir'"
+ 'FOAM_INST_DIR='"$prefixDir" \
+ "Setting fallback FOAM_INST_DIR to '$prefixDir'"
adjusted=true
shift
diff --git a/etc/bashrc b/etc/bashrc
index 658883d95c..07e5411ce3 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -47,7 +47,6 @@ FOAM_INST_DIR=$HOME/$WM_PROJECT
# END OF (NORMAL) USER EDITABLE PART
################################################################################
: # Extra safety - if the user commented out all fallback values
-export FOAM_INST_DIR
unset rc
# Configuration environment variables.
@@ -199,6 +198,7 @@ fi
. $WM_PROJECT_DIR/etc/config.sh/functions
# Variables (done as the last statement for a clean exit code)
+unset FOAM_INST_DIR # Old variable name (OpenFOAM-v1606) - now unneeded
unset cleaned foamOldDirs
#------------------------------------------------------------------------------
diff --git a/etc/config.csh/aliases b/etc/config.csh/aliases
index d423c053e4..d607fbf69c 100644
--- a/etc/config.csh/aliases
+++ b/etc/config.csh/aliases
@@ -57,13 +57,13 @@ alias uutil 'cd $WM_PROJECT_USER_DIR/applications/utilities'
# Refresh the environment
# ~~~~~~~~~~~~~~~~~~~~~~~
-alias wmRefresh 'set wmProjectDir=$WM_PROJECT_DIR; set foamSettings=$FOAM_SETTINGS; wmUnset; source $wmProjectDir/etc/cshrc $foamSettings'
+alias wmRefresh 'set projectDir=$WM_PROJECT_DIR; set foamSettings=$FOAM_SETTINGS; wmUnset; source $projectDir/etc/cshrc $foamSettings'
# Change OpenFOAM version
# ~~~~~~~~~~~~~~~~~~~~~~~
alias foamVersion \
- 'if ( "\!*" != "" ) source $FOAM_INST_DIR/OpenFOAM-\!*/etc/cshrc; foam; echo OpenFOAM-$WM_PROJECT_VERSION'
+ 'if ( "\!*" != "" ) source ${WM_PROJECT_DIR:h}/OpenFOAM-\!*/etc/cshrc; foam; echo OpenFOAM-$WM_PROJECT_VERSION'
# Change ParaView version
diff --git a/etc/config.sh/aliases b/etc/config.sh/aliases
index f93b5c6818..2a5c579064 100644
--- a/etc/config.sh/aliases
+++ b/etc/config.sh/aliases
@@ -65,31 +65,30 @@ wmRefresh()
}
-# Change OpenFOAM version
-# ~~~~~~~~~~~~~~~~~~~~~~~
+# Query the current OpenFOAM version
+# or change to another version (if installed in a parallel directory)
unset -f foamVersion 2>/dev/null
foamVersion()
{
if [ "$#" -gt 0 ]
then
+ local dir="${WM_PROJECT_DIR%/*}" # Parent directory
local ver=$1
shift
- # The variable foamInstDir had meaning for older OpenFOAM versions
- foamInstDir=$FOAM_INST_DIR
- if [ -f "$foamInstDir/OpenFOAM-$ver/etc/bashrc" ]
+
+ if [ -f "$dir/OpenFOAM-$ver/etc/bashrc" ]
then
wmUnset
- . $foamInstDir/OpenFOAM-$ver/etc/bashrc
- unset foamInstDir
+ . $dir/OpenFOAM-$ver/etc/bashrc
foam
echo "Changed to OpenFOAM-$WM_PROJECT_VERSION" 1>&2
else
- unset foamInstDir
- echo "No OpenFOAM-$ver available" 1>&2
+ echo "No OpenFOAM-$ver available in $dir" 1>&2
echo "Using OpenFOAM-$WM_PROJECT_VERSION" 1>&2
return 1
fi
else
+ # Treat as query. Report current version
echo "OpenFOAM-$WM_PROJECT_VERSION" 1>&2
fi
}
diff --git a/etc/cshrc b/etc/cshrc
index 8a95894abf..a1125b5b70 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -38,11 +38,11 @@ setenv WM_PROJECT_VERSION plus
# should work when sourced by CSH or TCSH shells. If this however fails,
# set one of the fallback values to an appropriate path.
# --
-setenv FOAM_INST_DIR `lsof +p $$ |& \
+set FOAM_INST_DIR=`lsof +p $$ |& \
sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc.*@@p'`
-# setenv FOAM_INST_DIR $HOME/$WM_PROJECT
-# setenv FOAM_INST_DIR /opt/$WM_PROJECT
-# setenv FOAM_INST_DIR /usr/local/$WM_PROJECT
+# set FOAM_INST_DIR=$HOME/$WM_PROJECT
+# set FOAM_INST_DIR=/opt/$WM_PROJECT
+# set FOAM_INST_DIR=/usr/local/$WM_PROJECT
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
@@ -240,6 +240,7 @@ unalias _foamAddLib
unalias _foamAddLibAuto
# Variables (done as the last statement for a clean exit code)
+unset FOAM_INST_DIR # Old variable name (OpenFOAM-v1606) - now unneeded
unset cleaned foamOldDirs
#------------------------------------------------------------------------------
diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler
index 98e645baf3..ff07cb4889 100755
--- a/wmake/wmakeScheduler
+++ b/wmake/wmakeScheduler
@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
-# \\/ M anipulation |
+# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@@ -45,7 +45,6 @@
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine.
-# FOAM_INST_DIR may possibly have been set (to find installation)
#
#-------------------------------------------------------------------------------
Script=${0##*/}
@@ -90,7 +89,7 @@ esac
# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# Check ~/.$WM_PROJECT/
# Check /etc/
-if [ "$WM_PROJECT" ]
+if [ -n "$WM_PROJECT" ]
then
for i in \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
@@ -108,20 +107,13 @@ fi
# Construct test string for remote execution.
# Source WM_PROJECT settings if WM_PROJECT environment not set.
-# Attempt to preserve the installation directory 'FOAM_INST_DIR'
# Use FOAM_SETTINGS to pass command-line settings
-case $sourceFoam in
+case "$sourceFoam" in
*/bashrc)
- if [ "$FOAM_INST_DIR" ]
- then
- sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
- else
- sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
- fi
+ sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
;;
*/cshrc)
- # TODO: csh equivalent to bash code (preserving FOAM_INST_DIR)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS"
;;
esac
diff --git a/wmake/wmakeSchedulerUptime b/wmake/wmakeSchedulerUptime
index 19a346a809..569470fb56 100755
--- a/wmake/wmakeSchedulerUptime
+++ b/wmake/wmakeSchedulerUptime
@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
-# \\/ M anipulation |
+# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@@ -45,7 +45,6 @@
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine.
-# FOAM_INST_DIR may possibly have been set (to find installation)
#
#-------------------------------------------------------------------------------
Script=${0##*/}
@@ -89,7 +88,7 @@ esac
# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# Check ~/.$WM_PROJECT/
# Check /etc/
-if [ "$WM_PROJECT" ]
+if [ -n "$WM_PROJECT" ]
then
for i in \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
@@ -107,20 +106,13 @@ fi
# Construct test string for remote execution.
# Source WM_PROJECT settings if WM_PROJECT environment not set.
-# Attempt to preserve the installation directory 'FOAM_INST_DIR'
# Use FOAM_SETTINGS to pass command-line settings
-case $sourceFoam in
+case "$sourceFoam" in
*/bashrc)
- if [ "$FOAM_INST_DIR" ]
- then
- sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
- else
- sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
- fi
+ sourceFoam='[ -n "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
;;
*/cshrc)
- # TODO: csh equivalent to bash code (preserving FOAM_INST_DIR)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam $FOAM_SETTINGS"
;;
esac
@@ -151,7 +143,7 @@ set -o pipefail
#
colourPipe()
{
- if [ "$1" ]
+ if [ -n "$1" ]
then
(
while read line