1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm_contrib/dyncore_ASP/params/p_cs32_1-3/prepare_run,v 1.1 2008/07/09 01:49:51 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
here=`pwd` |
7 |
#hdir=`basename $here` |
8 |
#hres=`echo $hdir | sed 's/_L.*$//' | sed 's/^.*_//'` |
9 |
#tstc=`echo $hdir | sed 's/^.*\.//'` |
10 |
hdir=`grep the_run_name data | sed 's/.*exp //'` |
11 |
hres=`echo $hdir | sed 's/_L.*$//' | sed 's/^.*\.//'` |
12 |
tstc=`echo $hdir | sed 's/\..*//'` |
13 |
rot=`echo $tstc | sed 's/^.-//' | sed 's/-.*$//'` |
14 |
echo "dir='$hdir' ; h-resolution='$hres' ; test-case='$tstc' ; rotation='$rot'" |
15 |
|
16 |
#- take files from this dir: |
17 |
fromDir="../input_${hres}_12" |
18 |
fileList=`( cd $fromDir ; ls fCor*.${rot}_${hres}.*bin )` |
19 |
|
20 |
#- and do a symbolic link in the current directory |
21 |
# (if the file does not already exist) |
22 |
if test -d $fromDir ; then |
23 |
lnkList='files:' |
24 |
for xx in $fileList |
25 |
do |
26 |
if test -r ${fromDir}/$xx ; then |
27 |
yy=`echo $xx | sed "s/\.${rot}_${hres}//"` |
28 |
if test ! -r $yy ; then |
29 |
lnkList=${lnkList}" "$yy |
30 |
ln -sf ${fromDir}/$xx $yy |
31 |
fi |
32 |
fi |
33 |
done |
34 |
echo ' link' $lnkList |
35 |
echo " from dir: $fromDir (sufx='${rot}_${hres}')" |
36 |
else |
37 |
echo " Error:" $fromDir "not a directory" |
38 |
fi |