Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # no file or directory with single uppercase letter name
- # unquoted grep parameter works correctly
- bash-4.2$ echo [A-Z]
- [A-Z]
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l
- 72
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l
- 72
- # file with single uppercase letter name
- # unquoted grep parameter leads to incorrect result
- bash-4.2$ touch A
- bash-4.2$ echo [A-Z]
- A
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l
- 8
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l
- 72
- # directory with single uppercase letter name
- # unquoted grep parameter leads to wrong result and error message
- bash-4.2$ mkdir B
- bash-4.2$ echo [A-Z]
- A B
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l
- grep: B: Is a directory
- 0
- bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep '[A-Z]' | wc -l
- 72
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement