This is probably a failure in my understanding of trap or of function invocation. I'd really appreciate if someone could explain. This is Solaris 10, but I don't think it matters.
The trap (cleanUp) never gets called. If I invoke check directly, it does, and if I add the trap to check2, it does, but not as written above. Why?
This is probably a failure in my understanding of trap or of function invocation. I'd really appreciate if someone could explain. This is Solaris 10, but I don't think it matters.
The trap (cleanUp) never gets called. If I invoke check directly, it does, and if I add the trap to check2, it does, but not as written above. Why?
I just tried this on Solaris and the trap isn't called with ksh from check2.
But if I use bash or sh it is taken!
It works fine in Linux with ksh.
I'm using Solaris x86. Ksh couldn't be different on that to other platforms... could it. Which are you using ahmad?
---------- Post updated at 07:03 AM ---------- Previous update was at 07:00 AM ----------
---------- Post updated at 07:17 AM ---------- Previous update was at 07:03 AM ----------
Quote:
Originally Posted by plavacek
This is probably a failure in my understanding of trap or of function invocation. I'd really appreciate if someone could explain. This is Solaris 10 , but I don't think it matters.
The trap (cleanUp) never gets called. If I invoke check directly, it does, and if I add the trap to check2, it does, but not as written above. Why?
Last edited by ahmad.diab; 06-20-2009 at 11:41 AM..
Hello,
I have this awk code in a bash script to perform a find and replace task. This finds one unique line in a file and substitutes the found line with a replacement.
#! /bin/bash
# value determined elsewhere
total_outputs_p1=100
# file being modified... (5 Replies)
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Hi,
I was working on implementing error handling in my bash scripts, and decided to use trap to send myself an email incase of any errors. But it seems that somethings has gone wrong, and I am continuously getting same emails for an old error repeatedly (even though I have stopped/killed all... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
That is the last reply I received from my instructor, and I'm looking for some alternatives.
When using... (2 Replies)
In my Bash script I have an exit/cleanup function in a trap statement like:
trap exitCleanup 1 2 3 6 15 25
Is there anyway to capture which signal # has occurred to record in a log file. Please note I am trying to avoid something like:
trap 'mySignal=1; exitCleanup' 1
trap... (1 Reply)
I have a script A which calls script B. I wrote a function in script A to be executed when Kill command is issued for script A and I invoke that function using the trap command.The function identifies all child process running under script A (in this case script B) and kills the child process and... (3 Replies)
Hi folks,
I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:....
The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)