If you want to run all scripts or executable binaries in a particular directory, you can use a command line utility called run-parts. This tool can automatically discover multiple scripts or programs in a directory, and run them all.
You can use run-parts command in the following format.
Scripts found in a directory will be run one by one in a lexically sorted order. run-parts will execute all the scripts whose names consist of alphanumeric letters, underscores and hyphens.
For example, to run all scripts in the current directory:
Optionally, you can run only those scripts whose names are matched with a regular expression. For that, use "--regex" option.
For example, to run all scripts in /etc whose names start with 'a' and end with '.sh':
With "--test" option, you can print the names of the scripts which would be executed, without actually running them. This is useful for testing purpose.
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.