On Sun, Jul 06, 2025 at 01:11:30PM +0200, Stefan Klinger wrote: > Some solutions are more compact and use only shell builtins, e.g., > > $ if ! (shopt -s failglob dotglob; : *) 2>/dev/null; then > echo is empty > fi > > but this may not port nicely to other shells (and has some other > caveats).
You should know/specify which shell the script is written for: #!/bin/some-shell With ksh the following works: [[ $( echo ~(N)* ~(N).[!.]* ) == '' ]] && echo empty || echo not empty -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 https://www.phcomp.co.uk/ Parliament Hill Computers. Registration Information: https://www.phcomp.co.uk/Contact.html #include <std_disclaimer.h>