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

Re: difficult alias



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 <markjreed@xxxxxxxxx>

On Sun, May 3, 2026 at 16:29 Ray Andrews <rayandrews@xxxxxxxxxxx> 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




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