• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Warning: tcsh, osascript, and HERE docs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warning: tcsh, osascript, and HERE docs


  • Subject: Warning: tcsh, osascript, and HERE docs
  • From: Doug McNutt <email@hidden>
  • Date: Mon, 24 Oct 2005 09:39:58 -0600

I was frustrated enough to file a bug report about this and, just in case there are others who sort of like tcsh ( no shell wars please),  I was getting this error on some stuff I was doing for use with BBEdit"

tcsh: else: endif not found.

It turns out that I was using osascript with a HERE document (redirecting input so that it comes from the script itself). The Applecript part was 20, or so, lines and it contained "if / end if" pairs in the AppleScript code. The tcsh script also contained its own "if / else / endif" controls with the endif spelled more conventionally. tcsh was incorrectly evaluating the HERE document lines it should have ignored when the if condition is true. It found the AppleScript "if" but never found its "endif" without a space. The complaint issued was that the tcsh if was never terminated because the final endif at the bottom terminates the AppleScript if rather than the tcsh if.

#  This fails
if (1 == 1) then
    echo "Huh?"
else
    osascript << EOF
    if 1 = 1 then
        display dialog "Huh?"
    end if
EOF
endif

#  This works but it looks pretty silly
set ifdude = "if"
if (1 == 1) then
    echo "Huh?"
else
    osascript << EOF
    $ifdude 1 = 1 then
        display dialog "Huh?"
    end if
EOF
endif

The original: <ftp://ftp.macnauchtan.com/Software/BBEdit/WorksheetOpen> wIll get fixed shortly.

--

-->  Halloween  == Oct 31 == Dec 25 == Christmas  <--
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Maybe OT: getting general information of a pdf file
  • Next by Date: Re: Do Shell script
  • Previous by thread: Re: [appscript] looking for feedback
  • Next by thread: Re: Warning: tcsh, osascript, and HERE docs
  • Index(es):
    • Date
    • Thread