zsh-workers
 help / color / mirror / code / Atom feed
* Re: Zsh Guide chapter 5 (substitutions)
       [not found] <1010816023151.ZM11189@candle.brasslantern.com>
@ 2001-08-17 13:02 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2001-08-17 13:02 UTC (permalink / raw)
  To: Zsh hackers list

Bart Schaefer wrote:
> On Aug 16, 12:00am, Peter Stephenson wrote:
>   ./myscript 2> >(grep -v idiot >error.log) |
>        process-output >output.log
> 
> Don't remove the space between them, either: for what
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> that will do, and for more on the meaning of `2>', see the section on
> redirections, below.
> ---------------
> 
> I don't know what you're driving at, there.

I think the answer is something on the lines of `I don't know what the hell
I'm talking about'.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Zsh Guide chapter 5 (substitutions)
       [not found] <1010821163843.ZM21870@candle.brasslantern.com>
@ 2001-08-28 21:25 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2001-08-28 21:25 UTC (permalink / raw)
  To: Zsh hackers list

Bart Schaefer wrote:
> And that's all, except that I'm left puzzling over this:
> 
>  The other tricky point is the use of double quotes in the eval. That
>  means that if the second argument has a double quote in it, the shell
>  will get very confused.
> 
> This refers to:
> 
>      eval "f2=\"$result\""
> 
> I'm left wondering whether
> 
>      f2=${(e)result}
> 
> wouldn't be equivalent and avoid the need for the double quotes?

Well, hmm.  Yeah.

Fixed some other things, too.

Index: Functions/Misc/zmv
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Misc/zmv,v
retrieving revision 1.8
diff -u -r1.8 zmv
--- Functions/Misc/zmv	2001/04/02 13:04:05	1.8
+++ Functions/Misc/zmv	2001/08/28 20:19:20
@@ -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 @@
     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 @@
 
 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 @@
   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 @@
 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

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-28 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1010816023151.ZM11189@candle.brasslantern.com>
2001-08-17 13:02 ` Zsh Guide chapter 5 (substitutions) Peter Stephenson
     [not found] <1010821163843.ZM21870@candle.brasslantern.com>
2001-08-28 21:25 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).