find . -perm -u+x,g+x,o+x -type f -exec grep -i -l -H -E '#!/bin/bash|#!/bin/sh' {} \; 2>/dev/null 1>/$user_scripts
I am tasked with finding any script that could exist for N users in 4 folders. I will be using ssh and executing the command above to generate a list of files for later use. Some scripts with the file extension .sh and .bash which do not contain #!/bin/bash|#!/bin/sh are not found.
I need to improve upon this but I am struggling to find something that works in the Solaris server which I have no admin rights for (No special software / libraries). If possible I would prefer not to need to execute another script that would needlessly appear in each list for each user.
Basically I need some kind of "If(find or grep)" in the same line. Is this possible?
-o
(logical or) argument tofind
, perhaps? Thus, after the;
ending-exec
, you'd say-o -name \*.bash -o -name \*.sh
. – Tom Hunt Oct 7 '15 at 17:48