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

Re: suspend (^Z) behavior while a function is running is unclear



On Feb 20,  7:33pm, Vincent Lefevre wrote:
} Subject: Re: suspend (^Z) behavior while a function is running is unclear
}
} > torch% foreach foo (a b c) { sleep 5 } | :  
} > zsh: job can't be suspended
} 
} However if the command outputs something, one loses the output.

I didn't really mean to imply that you should use this, just that some
of the plumbing is in place if we wanted to provide direct control.

On the other hand:

foreach foo (a b c) { print $foo; sleep 5 } | while { read -rE } { : }

(Using shortloops syntax to emphasize zsh-ness of this trick.)
 
} But with the encapsulation (to save typing), this is very limited.

As a hack, one could do:

    alias -g NOSUSP='|while { read -rE } { : }'

    foreach foo (a b c) { print $foo; sleep 5 } NOSUSP

This is similar to the "alias -g M='|more'" trick that I know a number
of people have used at one time or another.



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