McIDAS User's Guide
Version 2010.1

[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]


Using String Tables

Strings previously set in McIDAS can still be accessed from mcenv or at a Unix prompt. The command mceval.k must start any line containing a McIDAS string variable and a backslash (\) must precede pound signs (#). For example, to use the string D with its value IMGDISP EAST/FDV.0 from mcenv or a Unix prompt, add the command mceval.k and a pound sign (#) as shown below.

$ mceval.k \#D 2 MAG=-4 DAY=\#Y

The command mceval.k does not let you use a semicolon(;) as an argument. To run consecutive commands on the same line, mceval.k must be specified each time, as shown below.

$ mceval.k \#D 2 MAG=-4 DAY=\#Y ; mceval.k IMGLIST EAST/FDV.0 DAY=\#Y

It may be easier to use Unix variables to build McIDAS commands rather than McIDAS strings when writing Unix scripts. To use a Unix variable, set the Unix script variable to the command or value. Use quotes to enclose the command or value. The following two boxed examples use a script to list images. The first example uses Unix variables and the second uses strings. Both scripts produce the same output.

#!/bin/sh
# List images using Unix variables
mcenv << 'EOF'

logon.k USER 1234
# Make key in
# Set date to current Julian day
date=`date -u +%y%j`
# Build keyword
day="DAY=$date"

# Build commands
listFDV="imglist.k EAST/FDV"
listboth="imglist.k EAST/FDV $day ;imglist.k EAST/FDIR $day "

# Run keyin
eval $listFDV $day

# Run same keyin 2 times using a different form for each
eval $listFDV $day \; $listFDV DAY=${date}

# Run keyin with a Unix variable inside another Unix variable
# and also utilizes a ;
eval $listboth
exit
EOF
exit 0

 

#!/bin/sh
# List images using strings
mcenv << 'EOF'

logon.k USER 1234
# Make string
# commands
te.k listFDV \"IMGLIST EAST/FDV
te.k listnext \"IMGLIST EAST/FDIR DAY=\#Y

# Run keyin
mceval.k \#listFDV DAY=\#Y

# Run same keyin 2 times
mceval.k \#listFDV DAY=\#Y ; mceval.k \#listFDV DAY=\#Y

# Run keyin combination
mceval.k \#listFDV DAY=\#Y ; mceval.k \#listnext
exit
EOF
exit 0

[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]