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

How to mount a remote filesystem with SSHFS

We can mount a remote filesystem (username@servername:/remotefilesystem) in a local mountpoint (/local_mountpoint) with SSHFS:

sshfs -C -o idmap=user username@servername:/remotefilesystem /local_mountpoint

extra options:
-C use compression
-o idmap=user translate user ID of connecting user to allow local editing/saving of remote files.

To unmount use:

fusermount -u /local_mountpoint

or

umount /local_mountpoint

you may have to use administrative privileges.

For details consult:

the sshfs man page

SSH Filesystem oficial webpage

wikipedia entry