Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Table of contents Previous: Passing Variables into a mcenv Script Next: McIDAS-X Site Administration and Management Index

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


Table of contents Previous: Passing Variables into a mcenv Script Next: McIDAS-X Site Administration and Management Index
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690