Timeline for Avoiding non-zero exit code when running `ls` using multiple patterns
Current License: CC BY-SA 4.0
        11 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 5, 2022 at 20:32 | history | edited | ilkkachu | 
                
                    edited tags 
                
             | |
| Mar 5, 2022 at 20:29 | comment | added | ilkkachu | See also: Ignore "no matches" from zsh when using brace expansion with glob *.{a,b,}test | |
| Mar 5, 2022 at 15:07 | vote | accept | shikhanshu | ||
| Mar 5, 2022 at 14:21 | answer | added | Stéphane Chazelas | timeline score: 26 | |
| Mar 5, 2022 at 14:19 | history | became hot network question | |||
| Mar 5, 2022 at 12:17 | comment | added | Stéphane Chazelas | In zsh, you can useset -o cshnullglobto enable the csh behaviour, though you'd rather dols -d (foo|bar)/*there. See also Why is nullglob not default? | |
| Mar 5, 2022 at 11:32 | answer | added | terdon♦ | timeline score: 4 | |
| Mar 5, 2022 at 11:29 | comment | added | terdon♦ | @cas you need to test with {foo,bar}/*, the/*makes the difference. It's anullglobissue. | |
| Mar 5, 2022 at 11:10 | history | edited | terdon♦ | CC BY-SA 4.0 | 
                
                    added 18 characters in body; edited tags 
                
             | 
| Mar 5, 2022 at 9:08 | comment | added | cas | I think you are misinterpreting what you are seeing because that seems very unlikely - the exit code is coming from ls, and ls doesn't care whether it's being executed by bash or tcsh (also, i tested it on my system, and got an exit code of 2 in both bash and tcsh).   In any case, you probably don't want to be relying on ls to check whether a directory exists or not.  Usetest -d dir(or[ -d dir ]-[).  If you need to test existence of more than one, you can use boolean&&or||operators to combine tests, or use a for loop. | |
| Mar 5, 2022 at 6:16 | history | asked | shikhanshu | CC BY-SA 4.0 |