do not strip non-existent dirs

This commit is contained in:
mattijs
2009-04-02 13:11:14 +01:00
parent dbe15aa3f7
commit cbd181fa90

View File

@ -27,12 +27,12 @@
# foamCleanPath # foamCleanPath
# #
# Description # Description
# Usage: foamCleanPath path [wildcard] .. [wildcard] # Usage: foamCleanPath [-strip] path [wildcard] .. [wildcard]
# #
# Prints its argument (which should be a ':' separated path) # Prints its argument (which should be a ':' separated path)
# without all # without all
# - duplicate elements # - duplicate elements
# - non-accessible directories # - (if '-strip') non-accessible directories
# - elements whose start matches a wildcard # - elements whose start matches a wildcard
# #
# Note: # Note:
@ -42,16 +42,25 @@
if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ] if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ]
then then
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} path [wildcard] .. [wildcard] Usage: ${0##*/} [-strip] path [wildcard] .. [wildcard]
Prints its argument (which should be a ':' separated list) cleansed from Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements - duplicate elements
- non-accessible directories
- elements whose start matches one of the wildcard(s) - elements whose start matches one of the wildcard(s)
- (if '-strip') non-accessible directories
USAGE USAGE
exit 1 exit 1
fi fi
strip=''
if [ "$1" = "-strip" ]
then
strip=true
shift
fi
dirList="$1" dirList="$1"
shift shift
@ -94,6 +103,10 @@ do
then then
dirList="$dirList $dir" dirList="$dirList $dir"
fi fi
elif [ "$strip" != "true" ]
then
# Print non-existing directories if not in 'strip' mode.
dirList="$dirList $dir"
fi fi
done done