Advertisement
Guest User

Untitled

a guest
Mar 29th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # no file or directory with single uppercase letter name
  2. # unquoted grep parameter works correctly
  3.  
  4. bash-4.2$ echo [A-Z]
  5. [A-Z]
  6.  
  7. bash-4.2$ ls {/usr{/local,},}/{s,}bin | grep [A-Z] | wc -l
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement