SHOW:
|
|
- or go back to the newest paste.
1 | # no file or directory with single uppercase letter name | |
2 | - | grep: f: Is a directory |
2 | + | # unquoted grep parameter works correctly |
3 | - | grep: h: Is a directory |
3 | + | |
4 | - | grep: j: Is a directory |
4 | + | bash-4.2$ echo [A-Z] |
5 | - | grep: m: Is a directory |
5 | + | [A-Z] |
6 | - | grep: q: Is a directory |
6 | + | |
7 | - | grep: r: Is a directory |
7 | + | |
8 | - | 4 |
8 | + | 72 |
9 | ||
10 | bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l | |
11 | 72 | |
12 | ||
13 | # file with single uppercase letter name | |
14 | # unquoted grep parameter leads to incorrect result | |
15 | ||
16 | bash-4.2$ touch A | |
17 | ||
18 | bash-4.2$ echo [A-Z] | |
19 | A | |
20 | ||
21 | bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l | |
22 | 8 | |
23 | ||
24 | bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l | |
25 | 72 | |
26 | ||
27 | # directory with single uppercase letter name | |
28 | # unquoted grep parameter leads to wrong result and error message | |
29 | ||
30 | bash-4.2$ mkdir B | |
31 | ||
32 | bash-4.2$ echo [A-Z] | |
33 | A B | |
34 | ||
35 | bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l | |
36 | grep: B: Is a directory | |
37 | 0 | |
38 | ||
39 | bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l | |
40 | 72 |