Run a bash script or command using multiple input files

Here is how to run a bash script using a set of files in succession  as input:

for i in $( ls_to_select_input_files ) ; do your_scriptname_or_command $i ;done

For example,
The following command:

for i in $( ls *.inp ) ; do obchiral $i |grep Clockwise;done

will get all *.inp GAMESS input files in the directory and check the chirality of all chiral atoms with obchiral (from openbabel).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s