Syntax error: "(" unexpected.



  • Code

    main() {
        extern wakeup();
        signal(SIGNALARM, wakeup);
        while (1); {
            alarm(5);
            pause();
        }
    }
    

    Mistake

    ./script.sh: 3: ./script.sh: Syntax error: "(" unexpected (expecting "}")
    


  • Try this:

    #!/bin/bash
    main() {
    extern wakeup\(\);
    signal\(SIGNALARM, wakeup\);
    while [ 1 ]; do
    alarm\(5\);
    pause\(\);
    done
    }
    main
    

    I'm the only one who's making mistakes on the team that I don't have in the system, but you may have: pause (may be replaced by sleep ? externsignal and alarmThere's no other idea.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2