From cbd181fa90cde2c2d5c3d4cff3fecf9c96de49d3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 2 Apr 2009 13:11:14 +0100 Subject: [PATCH] do not strip non-existent dirs --- bin/foamCleanPath | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/foamCleanPath b/bin/foamCleanPath index 5eb203f553..dca96f490e 100755 --- a/bin/foamCleanPath +++ b/bin/foamCleanPath @@ -27,12 +27,12 @@ # foamCleanPath # # Description -# Usage: foamCleanPath path [wildcard] .. [wildcard] +# Usage: foamCleanPath [-strip] path [wildcard] .. [wildcard] # # Prints its argument (which should be a ':' separated path) # without all # - duplicate elements -# - non-accessible directories +# - (if '-strip') non-accessible directories # - elements whose start matches a wildcard # # Note: @@ -42,16 +42,25 @@ if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ] then cat <&2 -Usage: ${0##*/} path [wildcard] .. [wildcard] +Usage: ${0##*/} [-strip] path [wildcard] .. [wildcard] Prints its argument (which should be a ':' separated list) cleansed from - duplicate elements - - non-accessible directories - elements whose start matches one of the wildcard(s) + - (if '-strip') non-accessible directories USAGE exit 1 fi + +strip='' +if [ "$1" = "-strip" ] +then + strip=true + shift +fi + + dirList="$1" shift @@ -94,6 +103,10 @@ do then dirList="$dirList $dir" fi + elif [ "$strip" != "true" ] + then + # Print non-existing directories if not in 'strip' mode. + dirList="$dirList $dir" fi done