StartupItem with syntax error (sh script)

I'm comfy on the cli but still green with scripting it. I've followed the Apple tut on making a StartupItem, but I am getting simple (I hope) sh syntax errors when I run it. The three *Service functions are required, as they're called by the RunService function (from the sourced rc.common script) ... all per the Apple tutorial.
In any case, the error I get is:
line 7: syntax error near unexpected token `}'
/Library/StartupItems/blah/blah: line 7: `}'
The complaint is about the bracing earlier in execution than the 'tricky' stuff. I hope that suggests the problem is here and not in my Boot.bash script. I'll post that too if, as I'm noticing with scripting, the complaints about eofs and bracing and such are not where the real problem lies. I'm a bash person though so, especially if this is just an sh syntax misuse, feel free to give me what for.
Any thoughts, fixes, or straight advice appreciated,
Joel
#!/bin/sh
. /etc/rc.common
StopService() {
# nothing to kill
RestartService() {
StopService
StartService
StartService() {
/bin/bash /Library/Management/Boot.bash
RunService "$1"

Hi Joel,
   I've actually read a scripting guide that recommends defining functions with the "function" keyword and the norm is to put a space before and after the "()". However, your syntax is valid. In fact I see no errors at all; the script should work.
   Thus, the problem is most likely something invisible. It's time to investigate the text editor you used to create the script. You should open the script in a UNIX text editor, like vim, and look for hidden characters or Mac line endings. An even better solution might be to get the free text editor TextWrangler, (or BBEdit if you have it) open the file and set it to show invisible characters. It will also tell you what kind of line endings are used in the file. You might also post a long listing of the StartupItem script.
Gary
~~~~
   He's just a politician trying to save both his faces...

Similar Messages

  • Compiles a procedure with syntax error

    In the script tab, try to compile a procedure with syntax errors.
    The message displays procedure compiled !!!
    It should display that procedure compiled with errors.

    Hi Kris,
    I searched through the threads, but did not come across a similar question and that is why i raised the query. It'll be helpful if you could answer the query.
    regards,

  • Assistance with syntax error please

    this line of AS is giving me a syntax error and I cannot
    figure out the reason, requesting assistance please
    var mclListener.onLoadInit =
    function(target_mc:MovieClip):Void {
    target_mc.setMask(mask_mc);
    TIA

    thanks that resolved my error, but the script isn't working
    as expected. I am practicing from a book with AS 2.0 tutorials and
    this code is supposed to produce a mask from a movie clip over an
    image, but doesn't for me.
    I create a square on frame 1, make it a movie clip with the
    instance name of mask_mc and add this AS to frame 1.
    System.security.allowDomain.allowDomain("
    http://www.helpexamples.com");
    this.createEmptyMovieClip("img_mc", 10);
    mclListener.onLoadInit = function(target_mc:MovieClip):Void {
    target_mc.setMask(mask_mc);
    var my_mcl:MovieClipLoader = new MovieClipLoader();
    my_mcl .addListener(mclListener);
    my_mcl .loadClip("
    http://www.helpexamples.com/flash/images/image1.jpg",
    img_mc);
    my external jpg isn't getting masked by the MC....any
    ideas?

  • Getting Syntax Error in Script Editor

    I am a fairly new Mac user and also fresh to programming. I am trying run a piece of code that I copied directly from a guide but seems to be giving me a syntax error: "Expected 'into', variable name, other parameter name or property but found end of line."
    Here is the code that I am working with:
    on gestaltVersioninfo(gestaltcode, string_length)
    try
    tell application "Finder" to ¬
    copy my NumToHex((system attribute gestalt_code), ¬
    string_length) to {a, b, c, d}
    set the numeric_version to {a, b, c, d} as string
    if a is "0" then set a to ""
    set the version_string to (a & b & "." & c & "." & d) as string
    return {numeric_version, version_string}
    on error
    return {"", "unknown"}
    end try
    end gestaltVersion_info
    on NumToHex(hexData, stringLength)
    set hexString to {}
    repeat with i from stringLength to 1 by -1
    set hexString to ((hexData mod 16) as string) & hexString
    set hexData to hexData div 16
    end repeat
    return (hexString as string)
    end NumToHex
    copy my gestaltVersion_info("sysv", 4) to {system_version, system_string}
    if the system_version is less than "1050" then
    do shell script "/usr/bin/printf \"\\n# Block Adobe
    Activation\\n127.0.0.1\\tactivate.adobe.com\\n127.0.0.1\\tpractivate.adobe.com\
    \n127.0.0.1\\tereg.adobe.com\\n127.0.0.1\\tactivate.wip3.adobe.com\\n127.0.0.1\
    \tactivate.wip4.adobe.com\\n127.0.0.1\\twip3.adobe.com\\n127.0.0.1\\twip4.adobe
    .com\\n127.0.0.1\\t3dns-3.adobe.com\\n127.0.0.1\\t3dns-
    4.adobe.com\\n127.0.0.1\\t3dns-2.adobe.com\\n127.0.0.1\\tadobedns.
    adobe.com\\n127.0.0.1\\tadobe-dns-2.adobe.com\\n127.0.0.1\\tadobe-dns-
    3.adobe.com\\n127.0.0.1\\tereg.wip3.adobe.com\\n127.0.0.1\\tactivatesea.
    adobe.com\\n127.0.0.1\\twwis-dubc1-vip60.adobe.com\\n127.0.0.1\\tactivatesjc0.
    adobe.com\\n127.0.0.1\\thl2rcv.adobe.com\\n\" >> /etc/hosts" with
    administrator privileges
    else if the system_version is greater than "1050" then
    do shell script "/usr/bin/printf \"\\n# Block Adobe
    Activation\\n127.0.0.1\\tactivate.adobe.com\\n127.0.0.1\\tpractivate.adobe.com\
    \n127.0.0.1\\tereg.adobe.com\\n127.0.0.1\\tactivate.wip3.adobe.com\\n127.0.0.1\
    \tactivate.wip4.adobe.com\\n127.0.0.1\\twip3.adobe.com\\n127.0.0.1\\twip4.adobe
    .com\\n127.0.0.1\\t3dns-3.adobe.com\\n127.0.0.1\\t3dns-
    4.adobe.com\\n127.0.0.1\\t3dns-2.adobe.com\\n127.0.0.1\\tadobedns.
    adobe.com\\n127.0.0.1\\tadobe-dns-2.adobe.com\\n127.0.0.1\\tadobe-dns-
    3.adobe.com\\n127.0.0.1\\tereg.wip3.adobe.com\\n127.0.0.1\\tactivatesea.
    adobe.com\\n127.0.0.1\\twwis-dubc1-vip60.adobe.com\\n127.0.0.1\\tactivatesjc0.
    adobe.com\\n127.0.0.1\\thl2rcv.adobe.com\\n\" >> /etc/hosts;
    /usr/bin/dscacheutil -flushcache" with administrator privileges
    end if

    In your first *do shell script* statement, the *with administrator privileges* parameter is split across two lines. You just need to either put it on a single line or use option-return to continue a statement on the next line (not sure if the last *do shell script* has the same issue).
    Note that there is an AppleScript forum where these kinds of questions will be seen by a more targeted audience.

  • ICR: program FBICRC_GENERATE_CUST with syntax error

    Hi,
    in our Development system, the auto config program for ICR "FBICRC_GENERATE_CUST" is not working due to syntax error. It works in testsystem and productive system but not in development.
    Anyone experienced the same issue i.e. short dump when running FBICRC_GENERATE_CUST ?
    The following syntax error occurred in program "FBICRC_GENERATE_CUST " in
    include "FBICRC_GENERATE_CUST_F03 " in
    line 51:
    "The data object "LS_FBICRC01000" does not have a component called "HID"
    "E_DCURR"."
    Error analysis
        The following syntax error was found in the program FBICRC_GENERATE_CUST :
        "The data object "LS_FBICRC01000" does not have a component called "HID"
        "E_DCURR"."
    Thanks
    Stephane
    TRIUMPH ASIA

    HI  Eli,
    actually the problem only occurs after we implemented OSS note 1172591 with the SAP delievered transport P3EK049760
    So before having this transport: FBICRC_GENERATE_CUST  works fine
    AFTER the transport P3EK049760 contained in OSS note 1172591  -> syntax error.
    The field "hide_dcurr" is missing in table FBICRC01000
    Cheers
    Stephane

  • Xinitrc comes up with syntax error

    I was trying this setup for an xinitrc file:
    DEFAULT_SESSION=awesome
    case $1 in
    kde) exec startkde;;
    xfce4) exec startxfce4;;
    wmaker) exec wmaker;;
    blackbox) exec blackbox;;
    awesome) exec awesome;;
    openbox) exec openbox;;
    musca) exec musca;;
    wmii) exec wmii;;
    enlightenment) exec e16;;
    ratpoison) exec ratpoison;;
    etoile) exec etoile;;
    compiz) exec compiz;;
    ) exec $DEFAULT_SESSION
    *) exec $1;;
    esac
    Seems like it should work right? Well I guess Bash doesn't like the null case, and throws it out as a syntax error. Anyone know of a way around this?
    The reason I wanted to do this is because sometimes I'll just want to add a WM to /etc/slim.conf just to test it out.

    http://tldp.org/LDP/Bash-Beginners-Guid … 07_03.html
    Each case is an expression matching a pattern. The commands in the COMMAND-LIST for the first match are executed. The "|" symbol is used for separating multiple patterns, and the ")" operator terminates a pattern list. Each case plus its according commands are called a clause. Each clause must be terminated with ";;". Each case statement is ended with the esac statement.

  • Syntax Error in Script Editor

    Hey everybody. I'm brand new to Mac's (and programming for that matter). I've been trying to do some basic programming with AppleScript based on guides I found online. After making sure I copied the guide's code EXACTLY, I still get a Syntax error, which reads "expected "," or "}" but found property. The word "AppleScript" is highlighted in this instance. Strangely enough, no other instances of "AppleScript" are targeted with this error message. Like I said before, I've made sure to carefully copy everything from the guide I read and have done it multiple times, but still get this error message. Any help would be greatly appreciated!!

    Having another small problem. Two problems to be exact. Here is the code I have so far.
    set answer to the button returned of (display dialog ¬
    ¬
    "Welcome to the haunted house. Enter at your own risk. You have two options: Choose to Continue, or Run away." buttons {"Continue", "Run Away"} ¬
    with title "AppleScript Confusion" with icon note)
    if answer = "Continue" then
    display dialog ¬
    "You step into the foyer of the house and see two hallways on either side of you. Go left, or go right?" buttons {"Left", "Right"} ¬
    with title "AppleScript Confusion" with icon note
    if answer = "Right" then
    display dialog ¬
    "You step on a trap door and fall into a pit. You lose the game." buttons {"Exit"} ¬
    with title "AppleScript Confusion" with icon note
    else
    display dialog ¬
    "You walk down the hallway cautiously until you encounter a door." buttons {"Open Door"}
    with title "AppleScript Confusion" with icon note
    end if
    else
    display dialog ¬
    "You run out of the haunted house, starting your car and driving away." buttons {"Exit"} ¬
    with title "AppleScript confusion" with icon note
    First problem: the response doesn't seem to be working at all. I've clicked both buttons but only get the response under
    else
    I can't seem to get the response that's under
    if answer = "Right" then
    even if I am clicking the button that says "Right"
    Second problem:
    "with title "AppleScript Confusion" with icon note" in the paragraph under "else." Whenever I try to compile, the word "title" is highlighted and I get the error message "expected "timeout" or "transaction" but found identifier."
    An answer to one or both questions would be greatly appreciated!!

  • Why after installing Ver 17 US English, pop up error boxes appear with Syntax Error for Java Script Application?

    Should I uninstall the Java application and related plug ins or go back to Ver 16 in which this problem did not occur?

    Thank you for leading me to the detailed method of checking extensions. The Social Fixer Extension needed to be updated. Mission accomplished.

  • Cannot change password on LPM page with syntax error / AD2008

    Hi,
    In the Lost password Management page, user are prompt to change the password by input the old and new password.
    Identity/oblix/apps/lost_pwd_mgmt/bin/lost_pwd_mgmt.cgi?
    After type in the new password and click save the following error shows:
    "The Directory Server password syntax was violated. The password cannot be changed"
    Using AD2008 with ADSI security mode. OAM 10.1.4.3.0 BP03 on all components. Any idea on the above error?
    Appreciated for any feedback.
    Thanks

    Hi,
    The error message means that AD is not accepting the value for the new password. Usually that means that there is a password policy in AD itself (perhaps which requires 1 upper case letter, 2 non-alphanumeric characters etc) which is causing the value to be rejected. If that is the case, you could match OAM's password policy to be as close as possible to AD's (so that OAM can do the validation before sending it off to AD).
    Regards,
    Colin

  • Read table with syntax error

    I would like to have this in my report in ABAP 7:
              READ TABLE ti_prococolos WITH KEY
                                   protocol = lc_protocol
                                   status    = 'abc'
                                   status    = 'ced'.
    But I receive the following error, when verifying the syntax:
    Key field "STATUS" has been used more than once. This is not allowed .     
    How can I solve this?
    Thanks!

    The READ statement is used to read a specific row of the internal table, in this case it appears that you are saying that you want a record if the STATUS is either abc or def.  You can't do that with the READ.  You would need to use the LOOP.
    Loop at ti_prococolos where protocol = lc_protocal
                                        and ( status = 'abc' or status = 'ced' ).
    * do what ever here, and EXIT after since you only want one row.
    EXIT.
    endloop.
    Regards,
    RIch Heilman

  • SE01, SE09, SE10 throwing dumps with Syntax error

    We were applying some security notes in the SAP ECC6 Ehp1 system however, we forgot to implement a pre-requisite which was an external transport before implementing a note (in dev. we did it right but in test system, we forgot to do the external import first). Due to this, the RDDIMPDP job is getting cancelled every time & we get dumps whenever we use SE01 or SE09 or SE10.
    Pre-requisite note : 1497003
    Next note              : 1582138
    Could you please help resolving this issue ?
    Thank you !

    Hi,
    You can try with resetting note implementation in dev system which will generate one transport request. And move this transport request to test system as a result note will be reset in quality system as well.
    Then again implement note in dev and transport it to test system after implementing pre-requisite note.
    Thanks
    Sunny

  • Syntax Error on script

    OC

    You need to apply Julius Caesar's principle:
    Divide et impera. Instead of having half a dozen embedded functions on a single line you need to break them up into small pieces and, if needed, us the message box function to make the results visible. So to debug your code you should change
    Sched_Day = FormatDateTime(hex2dec(mid(Nstring,1,4)) + Dateserial(1981,1,1),2)
    to this
    a = mid(Nstring,1,4)
    b = hex2dec(a)
    c = Dateserial(1981,1,1)
    Sched_Day = FormatDateTime(b + c, 2)
    BTW - what variable type does DateSerial return?
    What does Hex2Dec return?
    Can you really add them together?

  • Dreamweaver CS6 and Coldfusion 9 - Syntax Errors & Code Coloring

    I recently purchased Dreamweaver CS6. 
    Also, I'm running Coldfusion 9 on Windows 7, but that's probably irrelevant.
    The issue is that Dreamweaver keeps on marking my files with syntax errors, and the code coloring gets all messed up.
    For instance, such function would indicate an error due to the #var#:
    <cfoutput><script>functionXYZ(#var#);<script><cfoutput>
    But this would work just fine:
    <script>functionXYZ(<cfoutput>#var#<cfoutput>);<script>
    The issue is that I have entire pages wrapped in cfoutput, redoing everything would take months.
    Or this would break the code coloring for the entire select as such:
    <select <cfif test eq 'test'>class="test"</cfif> name="selectbox">
    While this breaks the code coloring for the closing cfif as such:
    <select class="<cfif test eq 'test'>test</cfif>" name="selectbox">
    I'm getting syntax errors on thousands of my files, I understand that I could rewrite the code slightly to remove some of the error indications, but these are not actual errors so I feel that there is no point of me spending months updating the code.
    Is there a patch that I can apply so that this would work without any of these issues?
    Can someone please help?

    Have you posted this question in the Cold Fusion Forums?
    http://forums.adobe.com/community/coldfusion
    I don't use CF myself and the few CF coders I know have long since moved to Eclipse/ColdFusion Builder. 
    Nancy O.

  • Can't get Javascript to do anything - v5.5 - Syntax Error

    I know how to write javascript. I created an event on a slide and On Enter, I execute:
    <script type="text/javascript">
    alert('js doesnt work here');
    </script>
    That doesn't work. Syntax error. I try without the script tags = Syntax Error. I try without the semicolon =  Syntax Error. I try adding it to the standard.js and calling it from the slide = Syntax Error I try adding it to the <head> in myproject.htm and call from slide = Syntax Error.
    <script type="text/javascript">
    function test() {
        alert('js doesnt work here');
    </script>
    Why can I not get javascript to do anything at all? What is the correct syntax for the "Script_Window" ? Does it want the <script> tags? Does it want semicolons?
    Been working on this for 2 hours trying to get a simple alert to say hi.
    Or maybe it doesn't work with on enter/on exit events. I'll try buttons now, while I wait for a kind soul to hold my hand and teach me javascript.
    Thanks!

    Hello,
    I'm only a newbie with JavaScript, but when I put this in the script window in Captivate, it works after publishing and in Preview in Browser mode:
    alert("JS is working fine in Captivate");
    Sometimes knowing too much is blocking, it seems that Captivate is adding all the other stuff, since you are typing in the Script window for JS.
    BTW have a look at Jim Leichliter's blog, he is our JS-wizard:
    http://captivatedev.com/
    Look at the 'Tuts' part,
    Lilybiri
    PS you create a function, but are not calling that function or did I read it wrong?

  • Select-options in SELECT query - syntax error

    Hi all,
      I get the error below when I try to use the select options in a SELECT query . Please help me.
    "The IN operator with "SO_AWART" is followed neither by an internal
    table nor by a value list."
    The code i have used(Logical database  PNP is used):
    TABLES: pernr,
            catsdb.
    INCLUDE ztime_cwtr_top.    " global Data
    INCLUDE ztime_cwtr_f01.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS SO_AWART FOR CATSDB-AWART.
    PARAMETERS P_THRES TYPE I.
    SELECTION-SCREEN END OF BLOCK B1.
    Get data from CATSDB table. Workdates within the date interval are considered.
      SELECT pernr workdate awart catsquantity beguz enduz status
      FROM catsdb
      INTO TABLE it_catsdb
      WHERE pernr  = pernr-pernr    AND
           workdate GE pn-begda     AND
           workdate LE pn-endda     AND
           status   IN ('20', '30') AND
           awart    IN  so_awart .
          awart    IN ('1100', '1137', '1138', '1139', '1140',
                      '1147', '1148', '1149', '1157', '2003' ).
    when I give the values directly i do not get any syntax error, but when I use select options in the where condition I get the syntax error.
    I have tried different options like using only the select-options in the where condition.
    Thanks in advance.....
    Madhu

    Solved.
    Code with syntax error:
    include z...top .
    include z...fo1.
    select-options: xxxxxxx
    Code  with no syntax error:
    select-options: xxxxxxx
    include z...top .
    include z...fo1.
    Thanks for all your help,
    Madhu

Maybe you are looking for

  • Error while inserting data in Forms10G using TEXT_IO

    Dear all i am using 10g Forms. I am using Text_io to read the text file and putting into table and again reading the tables and putting into another text file . I was testing in 3 tables which is the same copy of the original table but only the name

  • My iTunes won't update

    My itunes wont update...everytime i try to update it says the file has become corrupted and that it will try to complete on the next update but i have tried redoing the update and still remains the same. I also cant get onto my itunes as it requires

  • Remote Desktop or KVM????

    I have a G5 Powermac with display sat next to a 15" imac flatscreen. Don't really want two keyboards and two mice. What is the best way to control the imac, with a KVM switch (seems overkill for merely two usb ports), a usb switch (has anyone got one

  • Book will not upload

    iphoto goes through the upload process for uploading book and right at the end comes up with an error message

  • IPhone not recognized by most computers

    Hi, My problem: iPhone 4 32GB is not recognized at all by the computer. A popup shows up: Unknown Device. Tried: - replacing the dock connector - completely restoring the device - putting it in DFU mode - PC ánd Mac - different cables - latest update