There are two problems here: 1. The syntax to define a function. Can we check http://tldp.org/LDP/abs/html/functions.html
2. The character "-" is really trick when define functions with. I changed to this: #!/bin/bash # get ready to catch errors trap ctrl_c INT trap unexpected_exit ERR ctrl_c () { echo echo "============================================" echo "Keyboard interrupt" echo "DHIS2 live exited" echo "============================================" exit } unexpected_exit () { echo "============================================" echo "DHIS2 live exited with an error" echo "Make sure you have a java runtime in your path" echo "============================================" read -p "Press any key to exit" } ... That works fine. Yes, it's really strange that only these days this is reported! Caveman On Fri, Feb 1, 2013 at 12:01 PM, Neeraj Gupta <neeraj.h...@gmail.com> wrote: > Lars, > > Below is the content of startup.sh > > *#!/bin/bash > > # get ready to catch errors > trap ctrl-c INT > trap unexpected-exit ERR > > function ctrl-c () { > echo > echo "============================================" > echo "Keyboard interrupt" > echo "DHIS2 live exited" > echo "============================================" > exit > } > > function unexpected-exit () { > echo "============================================" > echo "DHIS2 live exited with an error" > echo "Make sure you have a java runtime in your path" > echo "============================================" > read -p "Press any key to exit" > } > > echo "Starting DHIS2 live ..." > # java -jar dhis2-live.jar > DHIS2LIVE=`dirname $0` > #$JAVA_HOME/bin/ > java -jar $DHIS2LIVE/dhis2-live.jar > echo "DHIS2 live exited normally"* > > > > On Fri, Feb 1, 2013 at 3:14 PM, Lars Helge Ă˜verland > <larshe...@gmail.com>wrote: > >> Hi Neeraj, >> >> can you post the contents of the startup.sh script? >> >> Lars >> >> >> On Fri, Feb 1, 2013 at 11:26 AM, Neeraj Gupta <neeraj.h...@gmail.com>wrote: >> >>> Hi Devs, >>> >>> I was trying to work with DHIS Live on Ubuntu Server 11.10 , but I am >>> unable to run it, when i am running startup.sh it is saying >>> *trap: ERR: bad trap >>> /home/dhis-live/startup.sh: 7: Syntax error: "(" unexpected* >>> >>> Downloaded it from http://www.dhis2.org/downloads >>> >>> Tried it on windows and it worked fine. >>> Does DHIS-Live work with Linux also or it works with windows only? >>> >>> >>> >>> -- >>> Thanks, >>> Neeraj Gupta >>> >>> _______________________________________________ >>> Mailing list: https://launchpad.net/~dhis2-devs >>> Post to : dhis2-devs@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~dhis2-devs >>> More help : https://help.launchpad.net/ListHelp >>> >>> >> > > > -- > Thanks, > Neeraj Gupta > > _______________________________________________ > Mailing list: https://launchpad.net/~dhis2-devs > Post to : dhis2-devs@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dhis2-devs > More help : https://help.launchpad.net/ListHelp > >
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp