difficult alias

Ray Andrews <[email protected]> Sun, 3 May 2026 07:23:45 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------lA1TdfIPkUYccScRlH1D3wPX
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit


  % var="now is the time"

%  alias tst='echo $var | sed '\'s/the/THE/g\'''

... works.  But:

% alias tst='echo $var | fold -sw 80 | sed '\':a;N;$!ba;s/\n/\n /g\'''
zsh: command not found: N
zsh: now is the time not found

... can that alias be repaired?  The command run directly is fine, but 
the obscure stuff at the beginning of the 'sed' doesn't want to be 
aliased.  zsh seems to take the >:a;N;$!ba;< stuff as not being part of 
the sed.  AI recommended that BTW, I have no idea what it means, but it 
seems to make >\n\n   < possible which it wouldn't otherwise be.  Unless 
there's a  better way entirely ...

It just moves a block of text that's otherwise unwrapped into a nicer 
display: word wrap at 80 columns and spaced off the left margin by four 
chars.  Frivolous but I like it.




--------------lA1TdfIPkUYccScRlH1D3wPX
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <font face="DejaVu Sans"> % var="now is the time"<br>
      <br>
      %  alias tst='echo $var | sed '\'s/the/THE/g\'''<br>
      <br>
      ... works.  But:<br>
      <br>
      % alias tst='echo $var | fold -sw 80 | sed '\':a;N;$!ba;s/\n/\n   
      /g\'''<br>
      zsh: command not found: N<br>
      zsh: now is the time not found<br>
      <br>
      ... can that alias be repaired?  The command run directly is fine,
      but the obscure stuff at the beginning of the 'sed' doesn't want
      to be aliased.  zsh seems to take the &gt;</font><font
      face="DejaVu Sans">:a;N;$!ba;&lt; stuff as not being part of the
      sed.  AI recommended that BTW, I have no idea what it means, but
      it seems to make &gt;\n\n   &lt; possible which it wouldn't
      otherwise be.  Unless there's a  better way entirely ...<br>
      <br>
      It just moves a block of text that's otherwise unwrapped into a
      nicer display: word wrap at 80 columns and spaced off the left
      margin by four chars.  Frivolous but I like it.<br>
      <br>
      <br>
    </font><font face="DejaVu Sans"><br>
      <br>
    </font>
  </body>
</html>

--------------lA1TdfIPkUYccScRlH1D3wPX--