@@ -26,7 +26,8 @@ if test $# -lt 1; then
2626 x for flags x with value (e.g., -f value, -h being reserved for help)
2727 - for sequential arguments in the order defined, without flags
2828 + to capture all remaining arguments as a single variable with spaces as separators
29- & to capture all remaining arguments as a single variable with newlines as separators" >&2
29+ & to capture all remaining arguments as a multiple-line variable
30+ # to capture all remaining arguments with escaped spaces" >&2
3031 return 1
3132fi
3233
@@ -56,6 +57,9 @@ while read argname datatype varname help; do
5657 elif [ " $argname " = " &" ]; then
5758 line=" <$datatype ...>>"
5859 helpinfo=" $helpinfo \n\t$( printf ' %-12s : %s' " $name " " $help " ) "
60+ elif [ " $argname " = " #" ]; then
61+ line=" <$datatype ...>>"
62+ helpinfo=" $helpinfo \n\t$( printf ' %-12s : %s' " $name " " $help " ) "
5963 else
6064 if [ " $datatype " = " -" ]; then
6165 line=" [-$argname ]"
@@ -132,6 +136,21 @@ else
132136 echo " $arg ='$lines '"
133137 done
134138
139+ # Process remaining '#' parameters
140+ for arg in $( echo $varnames | grep -E " ^#" | cut -f2) ; do
141+ lines=" "
142+ while [ " $# " -gt " 0" ]; do
143+ # spaces that are not escaped should be preserved as part of the argument
144+ if [ -z " $lines " ]; then
145+ lines=" $( printf ' %s' " $1 " | sed ' s/ /\\ /g' ) "
146+ else
147+ lines=" $lines $( printf ' %s' " $1 " | sed ' s/ /\\ /g' ) "
148+ fi
149+ shift 1
150+ done
151+ echo " $arg ='$lines '"
152+ done
153+
135154 # Process remaining '+' parameters
136155 for arg in $( echo $varnames | grep -E " ^\+" | cut -f2) ; do
137156 if [ " $# " -gt " 0" ]; then
0 commit comments