Re: [PLUG] Bash Scripting Question
yes, but wouldn't it be easier to do that with just find? find . -executable -exec {} \; -wes On Fri, Sep 17, 2010 at 7:36 AM, Josh Cady josh.c...@gmail.com wrote: Probably a stupid question, but if one wanted to find all files with execute bits set in a folder (find . -executable), and then execute them, all within a bash script, is there a simple for files in * loop that would accomplish this? ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug
Re: [PLUG] Bash Scripting Question
On Fri, 17 Sep 2010, Josh Cady wrote: Probably a stupid question, but if one wanted to find all files with execute bits set in a folder (find . -executable), and then execute them, all within a bash script, is there a simple for files in * loop that would accomplish this? for F in *; do test -x $F ./$F done -- Paul Heinlein heinl...@madboa.com http://www.madboa.com/ ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug
Re: [PLUG] Bash Scripting Question
wes wrote: yes, but wouldn't it be easier to do that with just find? find . -executable -exec {} \; -wes On Fri, Sep 17, 2010 at 7:36 AM, Josh Cady josh.c...@gmail.com wrote: Probably a stupid question, but if one wanted to find all files with execute bits set in a folder (find . -executable), and then execute them, all within a bash script, is there a simple for files in * loop that would accomplish this? That will work ... but caution ... it does search subdirectories as well ... may need to add something like ... -maxdepth levels Descend at most levels (a non-negative integer) levels of direc‐ tories below the command line arguments. ‘-maxdepth 0' means only apply the tests and actions to the command line arguments. Check your man pages ... YMMV Regards Fred James ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug
Re: [PLUG] Bash Scripting Question
Thanks for the help. The find . -executable -exec '{}' \; works well. On Fri, Sep 17, 2010 at 8:31 AM, Fred James fredj...@fredjame.cnc.net wrote: wes wrote: yes, but wouldn't it be easier to do that with just find? find . -executable -exec {} \; -wes On Fri, Sep 17, 2010 at 7:36 AM, Josh Cady josh.c...@gmail.com wrote: Probably a stupid question, but if one wanted to find all files with execute bits set in a folder (find . -executable), and then execute them, all within a bash script, is there a simple for files in * loop that would accomplish this? That will work ... but caution ... it does search subdirectories as well ... may need to add something like ... -maxdepth levels Descend at most levels (a non-negative integer) levels of direc‐ tories below the command line arguments. ‘-maxdepth 0' means only apply the tests and actions to the command line arguments. Check your man pages ... YMMV Regards Fred James ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug ___ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug