diff --git a/bin/foamEtcFile b/bin/foamEtcFile index ea1d1c3fbf2c16098c3af6b20f6cd818a6eb5fae..195b91bdbe416b69f7390dc3aac61d14ccbdc866 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -46,7 +46,7 @@ printHelp() { cat<<USAGE -Usage: foamEtcFile [OPTION] fileName +Usage: foamEtcFile [OPTION] fileName [-- args] foamEtcFile [OPTION] [-list|-list-test] [fileName] options: @@ -270,6 +270,31 @@ done #------------------------------------------------------------------------------- +# Split arguments into filename (for searching) and trailing bits for shell eval +# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile) +nArgs=$# +fileName="${1#~OpenFOAM/}" +unset evalArgs + +if [ "$nArgs" -eq 1 ] +then + if [ "$1" = "--" ] + then + nArgs=0 + unset fileName + fi +elif [ "$nArgs" -ge 2 ] +then + if [ "$2" = "--" ] + then + nArgs=1 + shift 2 + evalArgs="$@" + fi +fi + + +# Get version information if [ -n "$optVersion" ] then setVersion $optVersion @@ -292,12 +317,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}" # eval echo "$i=\$$i" 1>&2 # done - -# Save the essential bits of information -# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile) -nArgs=$# -fileName="${1#~OpenFOAM/}" - # Define the various places to be searched: unset dirList case "$optMode" in (*u*) # (U)ser @@ -435,7 +454,12 @@ else echo "$verboseOutput$resolved" 1>&2 fi - echo "$shellOutput$resolved" + if [ -n "$shellOutput" ] + then + echo "$shellOutput$resolved $evalArgs" + else + echo "$resolved" + fi [ -n "$optAll" ] || break fi done diff --git a/etc/bashrc b/etc/bashrc index c7f8b7eb771ec1b2612254e70846ff3c8743df6f..f8d87bd4ebd51689a766f3260664e68d38ad9f40 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -153,7 +153,7 @@ _foamEtc -config settings # Setup for third-party packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamEtc -config mpi -_foamEtc -config paraview +_foamEtc -config paraview -- $@ # Pass through for evaluation _foamEtc -config vtk _foamEtc -config ensight _foamEtc -config gperftools diff --git a/etc/cshrc b/etc/cshrc index a678eda3c11960c3054503650476688d2685a0e5..8545e9f098df3e6a49938d67b99f3538b3aa13ee 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -196,7 +196,7 @@ _foamEtc -config settings # Setup for third-party packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamEtc -config mpi -_foamEtc -config paraview +_foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation _foamEtc -config vtk _foamEtc -config ensight ## _foamEtc -config ADIOS