| 1 | 
  
    
   | 
  | 2 | 
  
    ## oils_failures_allowed: 14
   | 
  | 3 | 
  
    ## compare_shells: bash
   | 
  | 4 | 
  
    
   | 
  | 5 | 
  
    
   | 
  | 6 | 
  
    # This is a bash-specific extension.
   | 
  | 7 | 
  
    expr $0 : '.*/osh$' >/dev/null && exit 99  # disabled until cd implemented
   | 
  | 8 | 
  
    touch _tmp/-n _tmp/zzzzz
   | 
  | 9 | 
  
    cd _tmp  # this fail in osh
   | 
  | 10 | 
  
    GLOBIGNORE=-*:zzzzz  # colon-separated pattern list
   | 
  | 11 | 
  
    echo -* hello zzzz?
   | 
  | 12 | 
  
    ## stdout-json: "-* hello zzzz?\n"
   | 
  | 13 | 
  
    ## N-I dash/mksh/ash stdout-json: "hello zzzzz"
   | 
  | 14 | 
  
    ## status: 0
   | 
  | 15 | 
  
    
   | 
  | 16 | 
  
    
   | 
  | 17 | 
  
    touch {basic.md,basic.txt}
   | 
  | 18 | 
  
    GLOBIGNORE=*.txt
   | 
  | 19 | 
  
    echo *.*
   | 
  | 20 | 
  
    ## STDOUT:
   | 
  | 21 | 
  
    basic.md
   | 
  | 22 | 
  
    ## END
   | 
  | 23 | 
  
    
   | 
  | 24 | 
  
    
   | 
  | 25 | 
  
    touch {1.txt,10.txt}
   | 
  | 26 | 
  
    GLOBIGNORE=?.txt
   | 
  | 27 | 
  
    echo *.*
   | 
  | 28 | 
  
    ## STDOUT:
   | 
  | 29 | 
  
    10.txt
   | 
  | 30 | 
  
    ## END
   | 
  | 31 | 
  
    
   | 
  | 32 | 
  
    
   | 
  | 33 | 
  
    touch {hello.c,hello.h,hello.o,hello}
   | 
  | 34 | 
  
    GLOBIGNORE=*.o:*.h
   | 
  | 35 | 
  
    echo hello*
   | 
  | 36 | 
  
    ## STDOUT:
   | 
  | 37 | 
  
    hello hello.c
   | 
  | 38 | 
  
    ## END
   | 
  | 39 | 
  
    
   | 
  | 40 | 
  
    
   | 
  | 41 | 
  
    mkdir src
   | 
  | 42 | 
  
    touch src/{__init__.py,__main__.py}
   | 
  | 43 | 
  
    GLOBIGNORE='src/__init__.py'
   | 
  | 44 | 
  
    echo src/*
   | 
  | 45 | 
  
    ## STDOUT:
   | 
  | 46 | 
  
    src/__main__.py
   | 
  | 47 | 
  
    ## END
   | 
  | 48 | 
  
    
   | 
  | 49 | 
  
    
   | 
  | 50 | 
  
    mkdir {src,compose,dist,node_modules}
   | 
  | 51 | 
  
    touch src/{a.js,b.js}
   | 
  | 52 | 
  
    touch compose/{base.compose.yaml,dev.compose.yaml}
   | 
  | 53 | 
  
    touch dist/index.js
   | 
  | 54 | 
  
    touch node_modules/package.js
   | 
  | 55 | 
  
    GLOBIGNORE=dist/*:node_modules/*
   | 
  | 56 | 
  
    echo */*
   | 
  | 57 | 
  
    ## STDOUT:
   | 
  | 58 | 
  
    compose/base.compose.yaml compose/dev.compose.yaml src/a.js src/b.js
   | 
  | 59 | 
  
    ## END
   | 
  | 60 | 
  
    
   | 
  | 61 | 
  
    
   | 
  | 62 | 
  
    mkdir {dir1,dir2}
   | 
  | 63 | 
  
    touch dir1/{a.txt,ignore.txt}
   | 
  | 64 | 
  
    touch dir2/{a.txt,ignore.txt}
   | 
  | 65 | 
  
    GLOBIGNORE=*/ignore*
   | 
  | 66 | 
  
    echo */*
   | 
  | 67 | 
  
    ## STDOUT:
   | 
  | 68 | 
  
    dir1/a.txt dir2/a.txt
   | 
  | 69 | 
  
    ## END
   | 
  | 70 | 
  
    
   | 
  | 71 | 
  
    
   | 
  | 72 | 
  
    rm -rf _tmp
   | 
  | 73 | 
  
    touch {a,b,c,d,A,B,C,D}
   | 
  | 74 | 
  
    GLOBIGNORE=*[ab]*
   | 
  | 75 | 
  
    echo *
   | 
  | 76 | 
  
    GLOBIGNORE=*[ABC]*
   | 
  | 77 | 
  
    echo *
   | 
  | 78 | 
  
    GLOBIGNORE=*[!ab]*
   | 
  | 79 | 
  
    echo *
   | 
  | 80 | 
  
    ## STDOUT:
   | 
  | 81 | 
  
    A B C D c d
   | 
  | 82 | 
  
    D a b c d
   | 
  | 83 | 
  
    a b
   | 
  | 84 | 
  
    ## END
   | 
  | 85 | 
  
    
   | 
  | 86 | 
  
    
   | 
  | 87 | 
  
    touch {_testing.py,pyproject.toml,20231114.log,.env}
   | 
  | 88 | 
  
    touch 'has space.docx'
   | 
  | 89 | 
  
    GLOBIGNORE=[[:alnum:]]*
   | 
  | 90 | 
  
    echo *.*
   | 
  | 91 | 
  
    GLOBIGNORE=[![:alnum:]]*
   | 
  | 92 | 
  
    echo *.*
   | 
  | 93 | 
  
    GLOBIGNORE=*[[:space:]]*
   | 
  | 94 | 
  
    echo *.*
   | 
  | 95 | 
  
    GLOBIGNORE=[[:digit:]_.]*
   | 
  | 96 | 
  
    echo *.*
   | 
  | 97 | 
  
    ## STDOUT:
   | 
  | 98 | 
  
    .env _testing.py
   | 
  | 99 | 
  
    20231114.log has space.docx pyproject.toml
   | 
  | 100 | 
  
    .env 20231114.log _testing.py pyproject.toml
   | 
  | 101 | 
  
    has space.docx pyproject.toml
   | 
  | 102 | 
  
    ## END
   | 
  | 103 | 
  
    
   | 
  | 104 | 
  
    
   | 
  | 105 | 
  
    # This pattern appears in public repositories
   | 
  | 106 | 
  
    touch {1.txt,2.log,3.md}
   | 
  | 107 | 
  
    GLOBIGNORE=*
   | 
  | 108 | 
  
    echo *
   | 
  | 109 | 
  
    ## STDOUT:
   | 
  | 110 | 
  
    *
   | 
  | 111 | 
  
    ## END
   | 
  | 112 | 
  
    
   | 
  | 113 | 
  
    
   | 
  | 114 | 
  
    touch {escape-10.txt,escape*.txt}
   | 
  | 115 | 
  
    GLOBIGNORE="escape\*.txt"
   | 
  | 116 | 
  
    echo *.*
   | 
  | 117 | 
  
    ## STDOUT:
   | 
  | 118 | 
  
    escape-10.txt
   | 
  | 119 | 
  
    ## END
   | 
  | 120 | 
  
    
   | 
  | 121 | 
  
    
   | 
  | 122 | 
  
    touch reset.txt
   | 
  | 123 | 
  
    GLOBIGNORE=*.txt
   | 
  | 124 | 
  
    echo *.*
   | 
  | 125 | 
  
    GLOBIGNORE=
   | 
  | 126 | 
  
    echo *.*
   | 
  | 127 | 
  
    ## STDOUT:
   | 
  | 128 | 
  
    *.*
   | 
  | 129 | 
  
    reset.txt
   | 
  | 130 | 
  
    ## END
   | 
  | 131 | 
  
    
   | 
  | 132 | 
  
    
   | 
  | 133 | 
  
    # globskipdots is enabled by default in bash >=5.2
   | 
  | 134 | 
  
    # for bash <5.2 this pattern is a common way to match dotfiles but not . or ..
   | 
  | 135 | 
  
    shopt -u globskipdots
   | 
  | 136 | 
  
    touch .env
   | 
  | 137 | 
  
    GLOBIGNORE=.:..
   | 
  | 138 | 
  
    echo .*
   | 
  | 139 | 
  
    ## STDOUT:
   | 
  | 140 | 
  
    .env
   | 
  | 141 | 
  
    ## END
   | 
  | 142 | 
  
    
   | 
  | 143 | 
  
    
   | 
  | 144 | 
  
    # each style of "ignore everything" spotted in a public repo
   | 
  | 145 | 
  
    touch image.jpeg
   | 
  | 146 | 
  
    GLOBIGNORE=*
   | 
  | 147 | 
  
    echo *
   | 
  | 148 | 
  
    GLOBIGNORE='*'
   | 
  | 149 | 
  
    echo *
   | 
  | 150 | 
  
    GLOBIGNORE="*"
   | 
  | 151 | 
  
    echo *
   | 
  | 152 | 
  
    GLOBIGNORE=\*
   | 
  | 153 | 
  
    echo *
   | 
  | 154 | 
  
    ## STDOUT:
   | 
  | 155 | 
  
    *
   | 
  | 156 | 
  
    *
   | 
  | 157 | 
  
    *
   | 
  | 158 | 
  
    *
   | 
  | 159 | 
  
    ## END
   |