diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2001-08-28 20:28:10 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2001-08-28 20:28:10 +0000 |
commit | b3336b791893f0c6a85c0aa9cec744af6a2c8d40 (patch) | |
tree | bd9c8ac71f456956521beefc1bbda46dffd42b79 | |
parent | c0ea4d62c81f7480192b1f61649f82d064dcb716 (diff) | |
download | zsh-b3336b791893f0c6a85c0aa9cec744af6a2c8d40.tar.gz zsh-b3336b791893f0c6a85c0aa9cec744af6a2c8d40.tar.xz zsh-b3336b791893f0c6a85c0aa9cec744af6a2c8d40.zip |
zmv fixes
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Functions/Misc/zmv | 13 |
2 files changed, 12 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index 6097f9093..9a9b68a97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-08-28 Peter Stephenson <pws@pwstephenson.fsnet.co.uk> + + * 15720: Functions/Misc/zmv: use ${(e)...} as suggested by + Bart; fix problem with option arguments with special characters; + more consistency with shifting arguments; fix verbose mode + output with backslashes. + 2001-08-28 Sven Wischnowsky <wischnow@zsh.org> * 15717: Src/subst.c, Src/Modules/parameter.c, diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv index b4f9b94ba..606c46bac 100644 --- a/Functions/Misc/zmv +++ b/Functions/Misc/zmv @@ -103,10 +103,6 @@ # are now turned off by default. To force the use of glob qualifiers, # give the flag -Q. # -# The second argument is re-evaluated in order to expand the parameters, -# so quoting may be a bit haphazard. In particular, a double quote -# will need an extra level of quoting. -# # The pattern is always treated as an extendedglob pattern. This # can also be interpreted as a feature. # @@ -130,7 +126,7 @@ while getopts ":o:p:MCLfinqQsvw" opt; do print -P "%N: unrecognized option: -$OPTARG" >&2 return 1 fi - eval "opt_$opt=${OPTARG:--$opt}" + eval "opt_$opt=${(q)OPTARG:--$opt}" done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) @@ -153,6 +149,7 @@ fi pat=$1 repl=$2 +shift 2 if [[ -z $action ]]; then # We can't necessarily get the name of the function directly, because @@ -229,9 +226,9 @@ for f in $files; do fi [[ -e $f && $f = (#b)${~pat} ]] || continue set -- "$match[@]" - eval g=\"$repl\" + g=${(e)repl} if [[ -z $g ]]; then - errs=($errs "$f expanded to empty string") + errs=($errs "\`$f' expanded to an empty string") elif [[ $f = $g ]]; then # don't cause error: more useful just to skip # errs=($errs "$f not altered by substitution") @@ -255,7 +252,7 @@ fi for f in $files; do [[ -z $to[$f] ]] && continue exec=($action ${=opt_o} $opt_s -- $f $to[$f]) - [[ -n $opt_i$opt_n$opt_v ]] && print -- $exec + [[ -n $opt_i$opt_n$opt_v ]] && print -r -- ${(q)exec} if [[ -n $opt_i ]]; then read -q 'opt?Execute? ' || continue fi |