[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

19991119: quoting apostrophes for shell script files (cont.)



>From: Robert Mullenax <address@hidden>
>Organization: NMSU/NSBF
>Keywords: 199911192037.NAA23504 McIDAS shell scripts

Robert,

>I just never even considered that it would work without escaping
>something.  I tried all sort of combinations of \,",'...etc.

I would have too, but I was able to ask Steve Emmerson who knows a lot
more about the shell scripting stuff than I do.  He passed along a
handly little piece of knowledge in this area that I forgot to pass
along in my last email.  You can easily check how the shell will
interpret quotes and the like by doing something like:

cat << EOF
G1="'PARAM Z;LEV 500;FHOUR 12'"
EOF

>Now one more problem if you don't mind.. If I make the FHOUR
>a variable again as it was before I whittled the
>script down how do I make that work:
>
>G1='PARAM Z;LEV 500;FHOUR $WWW_tim'
>
>McIDAS complains when I do that...when I enclose the $WWW_tim
>with double quotes, it produces no output.

It is as though WWW_tim is not being evaluated.  This worked for me,
so I am suprised:

setenv WWW_tim 12
cat << EOF
G1="'PARAM Z;LEV 500;FHOUR $WWW_tim'"
EOF
G1="'PARAM Z;LEV 500;FHOUR 12'"

I am betting that this failure is caused by using quotes around the EOF
portion of your script, as in:

MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << "EOF"

map.k NA
grddisp.k RTGRIDS/AVN TDA=CAL NAV=C DAY=1999323 DASH=NEG G1='PARAM Z;LEV 
500;FHOUR $WWW_tim;TIME 12;GPRO MERC' G2='LEV 1000' MATH='G1-G2' CINT=60

EOF

If you are doing this, try:

MCPATH=$MCPATH PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH mcenv << EOF

map.k NA
grddisp.k RTGRIDS/AVN TDA=CAL NAV=C DAY=1999323 DASH=NEG G1='PARAM Z;LEV 
500;FHOUR $WWW_tim;TIME 12;GPRO MERC' G2='LEV 1000' MATH='G1-G2' CINT=60

EOF

The quotes around the EOF tell the interpreter to not expand references
(like $WWW_tim).

>I really appreciate your help on this one.  The
>web page has really come quite far, but I have been raelly
>stuck on this,

Let me know if I was wrong on the "EOF" above.

>Thanks,

Later...

Tom