BASH - Executing Commands Parsed From File

Say you need to parse some executable files from wherever - they may come from an "ls" or from a "cat" to a file - and then run them. We can do this pipe, for instance:

ls -lR dir/to/pipe  | grep \\-rwxr\-xr\-x | awk '{ print $9 }' | bash

Which will pipe the executables from the "ls" command to awk for treatment and then to "bash" to be executed.
If you need to execute files treated from another way, just be sure they are arranged as one per line.

No comments:

Post a Comment