Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: expanding parameters like echo/print builtins

On 11 May 2011 19:07, Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> On Wed, 11 May 2011 18:38:46 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> The c and e flags will have tendencies to output unprintable
>> characters, can I write them in the expected test output somehow?
> The way to do this is to capture the output via a pipe or $(...) or
> whatever and then make that output readable by using ${(q)...} or
> something such.  There will be examples somewhere.  This does rely on
> the shell getting the reverse conversion right, but we test the features
> its relying on elsewhere so in theory we shouldn't get errors cancelling
> each other out.  (I'm loath to rely on od, and certainly xxd isn't
> standard enough.)

Hm, or could I use ${(V)${(g:c:):-'^X'}}? (actually putting V in the
same parens work, but the order isn't documented). (Should the order
parameter expansion flags are applied in be documented somewhere?)

  print -r ${(g:o:)foo}
  print -r ${(g::)foo}
  print -r ${(V)${(g:c:)foo}}
  print -r ${(V)${(g:e:)foo}}
  print -r ${(V)${(g:eo:)foo}}

Mikael Magnusson

Messages sorted by: Reverse Date, Date, Thread, Author