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

problem with 'ls | less' shell function



Hi!

I recently noticed a problem in zsh 5.9 (as built from pkgsrc) on
NetBSD 9.99.100. Since I didn't notice it before it could be related
to a change in NetBSD (I'm following the latest version), but I've
been told that the issue can be reproduced on Ubuntu 19.04 and FreeBSD
13.1 too; but not in zsh 5.8.1, nor in most other shells though.

The discussion on the NetBSD mailing list can be read in this thread:
https://mail-index.netbsd.org/current-users/2022/10/12/msg043076.html
but I'll summarize the issue I see in zsh here.

I have a shell function I've been using for ages:

dir() { ls -al "$@" | less; }

Recently, when I tried suspending this with CTRL-Z and then resuming
it with 'fg', I get:

$ dir
(CTRL-Z)
zsh: done       ls -al "$@" | 
zsh: suspended  
$ fg
[1]  + done       ls -al "$@" | 
       continued  
zsh: done                    ls -al "$@" | 
zsh: suspended (tty output)  
zsh: done                    ls -al "$@" | 
zsh: suspended (tty output)  

The same thing works in NetBSD's ksh:

$ fg
ls -al "$@" | less 
(CTRL-Z)
[1] + Done                 ls -al "$@" |
      Stopped              less 

or in bash

$ fg
ls -al "$@" | less
(CTRL-Z)

[1]+  Stopped                 ls -al "$@" | less

If I use '/bin/ls' in the shell function instead of 'ls', it works
fine.

Any ideas what the issue could be?

Cheers,
 Thomas

(I'll try to send this without subscribing first, since this seems to
be the address intended for bug reports.)




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