Search code examples
bashshellglobls

Shell script: list all entries that don't contain a number


I tried

#!/bin/bash
ls * [!0-9] * .*

but that doesn't work - I still get some files that contain a number.


Solution

  • If

    shopt extglob
    

    says

    extglob         on
    

    then you can try

    ls !(*[0-9]*)
    

    Use the following to enable this option

    shopt -s extglob