#!/bin/bash

#!/bin/bash

#!/bin/bash

#!/bin/bash

#!/bin/bash

#!/bin/bash

#!/bin/bash

#!/bin/bash

Bash is an evolved version of a terminal. It comes with OS X or any Unix flavor.

This section is divided in a series of script examples that give you an idea what you can do with bash using some other unix tools such as awk and sed.

condor_q

Condor is a cluster queuing tool. Alternatively people use pbs to submit jobs to a super computer cluster. Condor for example offers the possibility to list the current queue by using condor_q. However if you need to know where your jobs are running (on which node and in which directory), you need to run condor_q -l yourNameHere. This will give you a huge output you do not really need. Alternatively you can use awk to filter the desired effect.

001 #!/bin/bash
002 #Condor_q probe script by Ch.Fufezan 2006
003
004 if [ $# -ne 1 ];then
005       USER=christian
006 else
007       USER=$1
008 fi
009 echo ".-----------------------        "
010 /usr/local/condor/bin/condor_q -l $USER | awk -F '"| ' '
011   /ClusterId/ { i++; Id[i]=$3}
012   /Iwd/ {;Job[i]=$4}
013   /RemoteHost/ {node[i]=$4}
014 END \
015 {
016  printf(" %d Jobs running\n" , i); 
017  for (n=1; n<=i; n++) {
018     printf("%2d  %13s  %5s %7s \n" , n,node[n],Id[n], Job[n])
019  }
020 }'
021 echo "-----------------------  --     -"

type:bash   [ download ]

What happens - description is about to follow ...

For each file loop

Ever wished to loop over a set of given files and perform different kinds of actions on them ?

001 foreach file in *.pdb;
002 do
003  ls -l $file
004  cat $file | wc -l
005 done

type:bash   [ download ]