This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>From: Gilbert Sebenste <address@hidden> >Organization: NIU >Keywords: 200006031813.e53IDIT00341 McIDAS-X shell script Gilbert, >I see what you mean, but the following script gives me nothing but errors: > > >stty: standard input: Inappropriate ioctl for device >SF: Command not found. >EG: Command not found. >EG: Command not found. >EU: Command not found. >EU: Command not found. >GU: Command not found. >IMGDISP: Command not found. >REM: Command not found. >REM: Command not found. >MAP: Command not found. >EU: Command not found. >EU: Command not found. >GU: Command not found. >SVGIF: Command not found. >Unmatched ". > > >Here is the script, modified: >#!/bin/sh -f >MCHOME=/home/mcidas >MCDATA=$MCHOME/workdata >MCLOG=$MCDATA/scour.log >MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help >PATH=$MCHOME/bin:$PATH >exec 2>$MCLOG 1>&2 >LD_LIBRARY_PATH=/usr/local/lib:/lib:$MCHOME/lib:/usr/lib >cd $MCDATA >MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << 'EOF' >... You are still mixing Unix shell scripting with McIDAS BATCH syntax. You have two options: 1) put the McIDAS commands you list into a McIDAS BATCH file that exists in a directory in your MCPATH: /home/mcidas/workdata/CFDG.BAT:: SF 1 EG 1 EG I 1 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 IMGDISP RTGINI/GE1KVIS STA=EAR 1 WID=9 REM IMGDISP RTGINI/GW1KVIS STA=DSM 1 WID=9 REM IMGDISP G8-GHCC/VIS STA=VTN MAG=1 -2 1 WID=9 MAP VH 2 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 FRMSAVE 1 CFDG OS "mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg.gif MAP SAT 2 COU=ALL FRMSAVE 1 CFDG2 OS "mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg2.gif REM REM This is floater #2 SF 1 EG 1 EG I 1 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 IMGDISP RTGINI/GE1KVIS STA=UIN 1 WID=9 REM IMGDISP RTGINI/GW1KVIS STA=OKC 1 WID=9 REM IMGDISP G8-GHCC/VIS STA=LBF MAG=1 -2 1 WID=9 MAP VH 2 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 FRMSAVE 1 CFDG OS "mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg3.gif MAP SAT 2 COU=ALL FRMSAVE 1 CFDG2 OS "mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg4.gif EG 1 EG I 1 REM This is floater #3 SF 1 EG 1 EG I 1 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 IMGDISP RTGINI/GE1KVIS STA=SQI 1 WID=9 REM IMGDISP RTGINI/GW1KVIS STA=OKC 1 WID=9 REM IMGDISP G8-GHCC/VIS STA=SJT MAG=1 -2 1 WID=9 MAP VH 2 EU REST IMAGE2 EU REST IMAGE2 GU MAKE 2 50 0 0 FRMSAVE 1 CFDG OS "mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg5.gif MAP SAT 2 COU=ALL FRMSAVE 1 CFDG2 OS "mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg6.gif EG 1 EG I 1 Execute the commands in CFDG.BAT from a shell script kicked off by cron: #!/bin/sh -f MCHOME=/home/mcidas MCDATA=$MCHOME/workdata MCLOG=$MCDATA/scour.log MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help PATH=$MCHOME/bin:$PATH exec 2>$MCLOG 1>&2 LD_LIBRARY_PATH=/usr/local/lib:/lib:$MCHOME/lib:/usr/lib cd $MCDATA MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << 'EOF' batch.k CFDG.BAT exit EOF exit 0 If you intend to write a number of McIDAS BATCH scripts that you want run from cron, then generalize the Unix shell script to accept a command line argument that is the name of the McIDAS BATCH file: Unix shell script named mcbatch.sh #!/bin/sh -f MCHOME=/home/mcidas MCDATA=$MCHOME/workdata MCLOG=$MCDATA/scour.log MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help PATH=$MCHOME/bin:$PATH exec 2>$MCLOG 1>&2 LD_LIBRARY_PATH=/usr/local/lib:/lib:$MCHOME/lib:/usr/lib cd $MCDATA MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << 'EOF' batch.k $1 exit EOF exit 0 This would be executed like: mcbatch.sh CFDG.BAT 2) rewrite the commands that you want in Unix shell script format: #!/bin/sh -f MCHOME=/home/mcidas MCDATA=$MCHOME/workdata MCLOG=$MCDATA/scour.log MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help PATH=$MCHOME/bin:$PATH exec 2>$MCLOG 1>&2 LD_LIBRARY_PATH=/usr/local/lib:/lib:$MCHOME/lib:/usr/lib cd $MCDATA MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << 'EOF' sf.k 1 eg.k B 1 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 imgdisp.k RTGINI/GE1KVIS STA=EAR 1 WID=9 # imgdisp.k RTGINI/GW1KVIS STA=DSM 1 WID=9 # imgdisp.k G8-GHCC/VIS STA=VTN MAG=1 -2 1 WID=9 map.k VH 2 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 frmsave.k 1 CFDG mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg.gif map.k SAT 2 COU=ALL frmsave.k 1 CFDG2 mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg2.gif # This is floater #2 sf.k 1 eg.k B 1 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 imgdisp.k RTGINI/GE1KVIS STA=UIN 1 WID=9 # imgdisp.k RTGINI/GW1KVIS STA=OKC 1 WID=9 # imgdisp.k G8-GHCC/VIS STA=LBF MAG=1 -2 1 WID=9 map.k VH 2 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 frmsave.k 1 CFDG mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg3.gif map.k SAT 2 COU=ALL frmsave.k 1 CFDG2 GRA=1 mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg4.gif REM This is floater #3 sf.k 1 eg.k B 1 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 imgdisp.k RTGINI/GE1KVIS STA=SQI 1 WID=9 # imgdisp.k RTGINI/GW1KVIS STA=OKC 1 WID=9 # imgdisp.k G8-GHCC/VIS STA=SJT MAG=1 -2 1 WID=9 map.k VH 2 eu.k REST IMAGE2 eu.k REST IMAGE2 gu.k MAKE 2 50 0 0 frmsave.k 1 CFDG mv /home/mcidas/workdata/CFDG.GIF /home/httpd/html/cfdg5.gif map.k SAT 2 COU=ALL svgif.k 1 CFDG2 GRA=1 mv /home/mcidas/workdata/CFDG2.GIF /home/httpd/html/cfdg6.gif eg.k B 1 exit EOF # done exit 0 In the above, I have done the following: o changed the syntax so that the Unix shell script will run the actual McIDAS commands (e.g., eg.k instead of EG) o changed the 'EG 1' followed by 'EG I 1' to 'EG B 1' o changed SVGIF to frmsave.k (svgif.k/SVGIF is a command that is being sunsetted in 7.7; for more information on commands that will be sunset, please refer to: http://www.unidata.ucar.edu/packages/mcidas/mcx/sunset.html o changed 'OS "' use to use of simple Unix commands One question: You are running the EU command twice in a row. I believe that the reason you are doing this is to insure that the enhancement is correctly restored to the frame; true? If so, you might want to know that: o this is caused on systems running in 24-bit (actually, non-8-bit) mode o this has been fixed in McIDAS-X 7.7 (the release that I am working on right now and expect to have ready by the end of July/beginning of August) Tom