|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/miriad/userguide/node20.html
Дата изменения: Unknown Дата индексирования: Mon Apr 11 01:47:39 2016 Кодировка: Поисковые слова: rainbow |
There are numerous books written of shell programming or the like - a manual like this cannot be expected to cover the subject in the depth that these books go into. Instead a simple annotated example will be given using the C-Shell commonly used on UNIX systems. To aid description, line numbers are given on the left side of each line (these line numbers are not part of the shell script).
1: #!/bin/csh
2:
3: # Delete any datasets called "multi.uv".
4:
5: rm -rf multi.uv
6:
7: fits in=MULTI.UV op=uvin out=multi.uv
8:
9: foreach srcnam ( 1934-638 0823-500 vela )
10: uvaver vis=multi.uv "select=source(${srcnam})" out=${srcnam}.uv
11: end
12:
13: mfcal vis=1934-638.uv interval=10 refant=3
14: gpcal vis=1934-638.uv interval=10 options=xyvary refant=3
15: gpcopy vis=1934-638.uv out=0823-500.uv
16:
17: gpcal vis=0823-500.uv interval=10 \
18: options=nopol,xyvary,qusolve refant=3
19:
20: gpboot vis=0834-500.uv cal=1934-638.uv
21: uvplt vis=0823-500 stokes=i,q,u,v axis=real,imag device=0823.ps/ps
22:
23: lpr 0823.ps
#!/bin/csh. This allows the system to determine the
appropriate interpreter for the script (i.e. the C-shell).
multi.uv. The
r flag (recursive) is needed to delete a directory (which is
how Miriad stores a dataset). The f (force) flags causes rm to
work in non-interactive mode.
MULTI.UV), and saves it as a Miriad dataset
(multi.uv).
${srcnam}
with the current value of the srcnam variable.
Thus the select parameter being successively
set with source(1934-638), source(0823-500) and
source(vela) on the three times through the loop. The output dataset of the command also changes.
Note that the select parameter is quoted ("select=...
").
This is as brackets (()) are special to the shell. Quoting them
prevents this interpretation. Note however that the ${srcnam} is
still treated as special, even though it is in quotes (software does not have
to be consistent!).
On UNIX systems, after having developed a script, you will need to change the ``file mode'' of the script to indicate that the script is executable. For example, to mark the shell script calibrate as executable, use the UNIX command
% chmod +x calibrate
Miriad manager