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.

5
  • (0) Which do you prefer, arcane and correct or intuitive and flawed?  I prefer correct.  (1) innaM’s answer, featuring find -perm, finds files that have any execute permission bit set.  (2) By contrast, this answer finds only files for which the current user has execute permission.  Granted, that might be what the OP wants, but it’s unclear.  … (Cont’d) Commented Apr 24, 2016 at 4:36
  • (Cont’d) …  (3) For clarity, you might want to change `…` to $(…) — see this, this, and this.  (4) But don’t do for i in $(find …); do …; it fails on filenames that contain space(s).  Instead, do find … -exec ….  (5) And, when you do work with shell variables, always quote them (in double quotes) unless you have a good reason not to, and you’re sure you know what you’re doing. Commented Apr 24, 2016 at 4:36
  • @scott OK, I stand corrected :) I read the -perm argument as requiring all three, not one of them. Also, thank you for the input on protecting shell arguments, that's all stuff I wasn't aware of. Commented Apr 25, 2016 at 13:50
  • @MarkMcKenna you have a typo in there: for i in find . -type f; do [ -x $i ] && echo "$i is executable"; done; you are missing the <dir> part, which I use a dot(.)
    – Devy
    Commented Aug 31, 2016 at 20:07
  • @Scott find -exec seems to fail if what I want to do is source the found file, so I'm using for... do...
    – Jeff
    Commented Feb 17, 2021 at 23:51