Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • There could be bin outside bin/ or games/. Commented Apr 1, 2014 at 7:38
  • dpkg -L apache2 | egrep '(bin|games)/' No result. Please improve your answer Commented Apr 1, 2014 at 7:39
  • @Hadi apache2 may be a bad example because that package is a metapackage that usually isn't even installed on systems running Apache. The command works - try coreutils: dpkg -L coreutils | egrep '(bin|games)/' Commented Apr 1, 2014 at 7:56
  • 1
    +1, very nice. Just a couple of comments, you might want to use grep -Ew 'bin|sbin|games' instead, egrep is deprecated and you may as well search for sbin as well. Also, there is no reason to use a for loop here, using a while loop as I did in my answer instead, means you don't need to worry about IFS and word splitting. Commented Apr 1, 2014 at 15:25
  • 1
    From man grep: Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified. Also, you regex, will match any directory that contains either games or bin which will include /usr/share/games/, and also foosbinaff and whatever else. Commented Apr 1, 2014 at 18:57