In response to TorgoX’s scripting, because he hasn’t enabled comments:
If you don’t need all of the checks his script implements, you can do the same with a simple shell command:
( IFS=: ; find $PATH -maxdepth 1 -xtype f -perm +111 )
If you need to check the readability of files, robustly, it instantly gets much harder:
( IFS=: ; find $PATH -maxdepth 1 -xtype f -perm +111 -print0 ) \ | xargs -r0 sh -c 'for f in "$@" ; do [ -r "$f" ] && echo "$f" ; done' --
Robust dupe checks, unfortunately, are impossible in shell, because uniq
requires sorted input and both it and sort
can only deal with linefeed-separated lines – null-terminated records, which would be necessary, are a non-starter.
It’s frustrating how inconsistently expressive the shell tools are.