Re: difficult alias
"Mark J. Reed" <[email protected]> Sun, 3 May 2026 16:50:05 -0400
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAA=-s3x4nz2bYFMxgKmCuuuG-dXXHfpXovFMFNQ6t5xvtY69WQ@mail.gmail.com> |
--0000000000001911020650eff6e5
Content-Type: text/plain; charset="UTF-8"
Also as a function you can just supply the value as a parameter instead of
hard coding the use of $var. you could even default to a predefined named
variable if no parameter is specified, e.g.
tst() {
fold -sw 80 <<<"${1:-$var}" | sed '...'
}
Which will operate on whatever you pass to it but if you don't pass
anything will use the value of $var.
Mark J. Reed <[email protected]>
On Sun, May 3, 2026 at 16:29 Ray Andrews <[email protected]> wrote:
>
>
> On 2026-05-03 12:26, Klaus Ethgen wrote:
> > Hi,
> >
> > Am So den 3. Mai 2026 um 15:23 schrieb Ray Andrews:
> >> % 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
> > Is it just me or are you using an unquoted ";"?
> I gave up trying to fix it. There's three levels of quotes as it is.
> As Eric said, just make it a function and there's no issue.
>
> >
> > Regards
> > Klaus
>
>
>
--0000000000001911020650eff6e5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto">Also as a function you can just supply the value as a par=
ameter instead of hard coding the use of $var. you could even default to a =
predefined named variable if no parameter is specified, e.g.</div><div dir=
=3D"auto"><br></div><div dir=3D"auto">tst() {=C2=A0</div><div dir=3D"auto">=
=C2=A0 =C2=A0 fold -sw 80 <<<"${1:-$var}" | sed '...=
'</div><div dir=3D"auto">}</div><div dir=3D"auto"><br></div><div dir=3D=
"auto">Which will operate on whatever you pass to it but if you don't p=
ass anything will use the value of $var.</div><div><br clear=3D"all"><br cl=
ear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=
=3D"gmail_signature">Mark J. Reed <<a href=3D"mailto:[email protected]=
" target=3D"_blank">[email protected]</a>><br></div></div></div><div><=
br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=
=3D"gmail_attr">On Sun, May 3, 2026 at 16:29 Ray Andrews <<a href=3D"mai=
lto:[email protected]">[email protected]</a>> wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:r=
gb(204,204,204)"><br>
<br>
On 2026-05-03 12:26, Klaus Ethgen wrote:<br>
> Hi,<br>
><br>
> Am So den=C2=A0 3. Mai 2026 um 15:23 schrieb Ray Andrews:<br>
>> % alias tst=3D'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>
> Is it just me or are you using an unquoted ";"?<br>
I gave up trying to fix it.=C2=A0 There's three levels of quotes as it =
is.=C2=A0 <br>
As Eric said, just make it a function and there's no issue.<br>
<br>
><br>
> Regards<br>
>=C2=A0 =C2=A0 =C2=A0Klaus<br>
<br>
<br>
</blockquote></div></div>
--0000000000001911020650eff6e5--