hpux 11 here document problem
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > hpux 11 here document problem




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    hpux 11 here document problem  
KT


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM

Hi All,

The OS is "HP-UX tuna B.11.00 U 9000/800 522706547 unlimited-user
license"
When the following function is called, it always complain
"ksh: syntax error at line 6 : `fi' unexpected"

I put in print statements for debugging and found that this error is
generated at "EMB_BUILD" delimiter-word of the here document at the end
of the function.

Is this a bug in the shell? How do I get around of it?

function emb_build {
ALL=FALSE
LASB=FALSE
IAHV=FALSE
ISH=FALSE
RSH=FALSE

PS3='Pick one of the above:'
select i in all lasb iahv ish rsh finish
do case $i in
all)    ALL=TRUE
break;;
iahv)   IAHV=TRUE;;
lasb)   LASB=TRUE;;
ish)    ISH=TRUE;;
rsh)    RSH=TRUE;;
finish) print -u2 "finished embedded selection"
break;;
esac
done

if [ $ALL = TRUE ]
then
IAHV=TRUE
LASB=TRUE
ISH=TRUE
RSH=TRUE
fi

$CL setview P10_V230_EMB_Build  << EMB_BUILD

if [ $DEL_FLAG = TRUE ]
delay # sleep and wake up sometime after midnight
DEL_FLAG=FALSE # Only 1 delay allowed
fi

if [ $IAHV = TRUE ] # iahv build
then
test -f $curDir/Embd_builds/iahv/ArchitectProjects/done.txt && rm -f
$curDir/E
mbd_builds/iahv/ArchitectProjects/done.txt
cd $curDir/Embd_builds/iahv
./bigbang.sh -e IAHV.prj
fi

if [ $LASB = TRUE ] # lasb build
then
test -f $curDir/Embd_builds/lasb/ArchitectProjects/done.txt && rm -f
$curDir/
Embd_builds/lasb/ArchitectProjects/done.txt
cd $curDir/Embd_builds/lasb
./bigbang.sh -e P6_LSH.prj
fi

if [ $ISH = TRUE ] # ish build
then
test -f $curDir/Embd_builds/ish/ArchitectProjects/done.txt && rm -f
$curDir/Em
bd_builds/ish/ArchitectProjects/done.txt
cd $curDir/Embd_builds/ish
./bigbang.sh -e ISH.prj
fi

if [ $RSH = TRUE ] # rsh build
then
test -f $curDir/Embd_builds/rsh/ArchitectProjects/done.txt && rm -f
$curDir/Em
bd_builds/rsh/ArchitectProjects/done.txt
cd $curDir/Embd_builds/rsh
./bigbang.sh -e RSH.prj
fi

EMB_BUILD
}


 ========================================
=========================
Snippet of the output:

+ [ TRUE = TRUE ]
+ emb_build
1) all
2) lasb
3) iahv
4) ish
5) rsh
6) finish
Pick one of the above:4
Pick one of the above:6
finished embedded selection
ksh: syntax error at line 6 : `fi' unexpected
+ [ FALSE = TRUE ]
+ [ FALSE != TRUE ]
+ scc_build






[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
Fletcher Glenn


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM

KT wrote:
> Hi All,
<snipped>
>  if [ $ALL = TRUE ]
>  then
>       IAHV=TRUE
>       LASB=TRUE
>       ISH=TRUE
>       RSH=TRUE
>  fi
<snipped>

The correct format for the above is:

if [ $ALL = TRUE ] ; then
...
...
fi

Note the semicolon above.

--

Fletcher Glenn






[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
Ed Morton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM



Fletcher Glenn wrote:
> KT wrote:
> 
>
> <snipped>
> 
>
> <snipped>
>
> The correct format for the above is:
>
> if [ $ALL = TRUE ] ; then
> ...
> ...
> fi
>
> Note the semicolon above.

No, the original is fine. Whether you do this:

if [ whatever ] ; then

or this:

if [ whatever ]
then

is purely a matter of taste/style.

Ed.





[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
Ralf Fassel


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM

* "KT" <kerr_tung@yahoo.com>
|  if [ $IAHV = TRUE ] # iahv build

Have you tried w/o the comment after the test?

# iahv build
if [ $IAHV = TRUE ]
then
..

HP once didn't like comments or flags in the #!/bin/sh line either...

R'





[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
S. Anthony Sequeira


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM

KT wrote:

> $CL setview P10_V230_EMB_Build  << EMB_BUILD
>
>  if [ $DEL_FLAG = TRUE ]
>   delay # sleep and wake up sometime after midnight
>   DEL_FLAG=FALSE # Only 1 delay allowed
>  fi

There *is* a 'then' missing.
--
Tony





[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
Sven Mascheck


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-09-05 10:53 PM

[f'up2 c.u.shell]

Ralf Fassel wrote:
> |  if [ $IAHV = TRUE ] # iahv build
>
> Have you tried w/o the comment after the test?

To the best of my knowledge, all bourne compatible shells properly
parse such a line (given correct syntax in the following lines).

> HP once didn't like comments or flags in the #!/bin/sh line either...

That's a completely different issue because the #! line is parsed
by the kernel and not by a shell.  On most unix variants, including
HP-UX 8-11, the whole line is passed on as one argument.  Important
exceptions are SunOS 5, OpenServer 5 and Ultrix, which split and
pass on the first "argument" only, and FreeBSD which really splits
up and fills argv[].





[ Post a follow-up to this message ]



    Re: hpux 11 here document problem  
Jan Gerrit Kootstra


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-10-05 07:49 AM

Ralf Fassel wrote:
> * "KT" <kerr_tung@yahoo.com>
> |  if [ $IAHV = TRUE ] # iahv build
>
> Have you tried w/o the comment after the test?
>
>     # iahv build
>     if [ $IAHV = TRUE ]
>     then
>     ...
>
> HP once didn't like comments or flags in the #!/bin/sh line either...
>
> R'
Ralf,


I was more think of:

if [ $IAHV ="TRUE" ]
then
....


Regards,


Jan Gerrit





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:46 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register