AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Interrupt in shell script

    Posted Wed August 05, 2015 08:38 AM

    Originally posted by: Bernimac


    I have a ksh shell script which runs executes a unidata command.

    I want to write into the script that if it is interrupted in anyway it exits out without running the unidata command.

     

     



  • 2.  Re: Interrupt in shell script

    Posted Thu August 06, 2015 09:19 AM

    Originally posted by: DaveMarquardt


    So what do you want to do while the unidata command is running? Anyway, look into the shell trap command. Maybe something like

    trap "exit" INTR

    at the top of your script might work.



  • 3.  Re: Interrupt in shell script

    Posted Mon August 10, 2015 05:31 AM

    Originally posted by: Bernimac


    Thanks.



  • 4.  Re: Interrupt in shell script

    Posted Tue September 01, 2015 09:46 AM

    Originally posted by: PontiacGeronimo



    vary usefull can also be set -u and set -e for preventing unexpected behaviour in case of some crucial part of code fails or not expected empty variables