next up previous
Next: Program awk - operacje Up: wyklad12 Previous: Warunkowa instrukcja pêtli while.

Instrukcja wyboru case.

#! /bin/tcsh -f
# C shell script for running lmin
# to be run from the directory lattice
set ARCH = AIX
set RUN = /users/galholk/adaml/lmin/run
set CURDIR = `pwd`
echo "current directory" ${CURDIR}
set echo
set mol=$1
set nonb = ~/MonteCarlos/Source/lat
if (${#mol} == 0) then
 echo -n "choose a crystal - "
 exit
endif
foreach v (coord lattice)
 if (! -e ${mol}.${v}) then
  echo "file ${mol}.${v} not found - start over"
  exit
 endif
end
set prg=$2
if (${#prg} == 0) then
 echo -n "specify a program - "
 exit
endif
switch ($prg)
case 'c':
 if (! -e ${mol}.input) then
  echo "file ${mol}.input not found - start over"
  exit
 endif
 breaksw
case 'e':
 if (! -e ${mol}.input) then
  set nonb = latSS
  echo "file ${mol}.input not found - start over"
  exit
 endif
 breaksw
case 'p':
 if (! -e ${mol}.input) then
  echo "file ${mol}.input not found - start over"
  exit
 endif
 breaksw
default:
 echo "try again - "
 exit
endsw
/bin/cp ${mol}.coord ${mol}.lattice ${RUN}
/bin/cp ${nonb}.data ${RUN}/lat.data
if (-e ${mol}.input) /bin/cp ${mol}.input ${RUN}
cd ${RUN}
ln -s  $mol.xyz fort.7
ln -s  ${mol}_ini.cry fort.17
ln -s  ${mol}_fin.cry fort.18
ln -s  lat.data fort.8
ln -s  $mol.out fort.10
ln -s  $mol.input fort.11
ln -s  $mol.lattice fort.12
ln -s  $mol.coord fort.15
ln -s  $mol.sumsl fort.16
ls -l fort*
ls -s $nonb.data
lmin{$prg}${ARCH}



Adam Liwo 2002-03-07