Is there a way for me to implement custom fake signals in ksh? Currently am capturing the ERR signal and exiting. However, due to a change, there are calls that may not return success, however that is a valid condition. In such case, I want to make sure that this call generates a different signal or handle the ERR differently. Is there a way to do that?
2
There are 2 best solutions below
1
imz -- Ivan Zakharyaschev
On
Perhaps you could simply wrap the statements whose exit codes you want to treat specially in a construction that would simply do what you want (employing "or" or "if not" constructions and analyzing the exit codes).
That seems to be a much cleaner programming style, doesn't it?
Related Questions in SIGNALS
- How can I chop up data before sending it into a multiprocessing function?
- Why does registering a handler function for SIGHUP prevent clicking the "X" to close the XTerm window when waiting for input in PHP CLI?
- How to use angular material drag and drop CDK to update value in a service?
- Run cleanup function in Python when Jenkins job is aborted
- How to generate a single key-press event signal with tkinter.bind method
- How can I fit my data better or shift my data? My fit is way below my data
- (Bash, terminal) why do killing script hotkeys don't work (e.g. ctrl-c, ctrl-z)
- In a Linux signal handler, will x86 extended state always be in XSAVE format, or can it be in XSAVEC format as well?
- Passing an Angular signal value from a component input into a service
- How is Unix signal propagated to PGID in namespaces and what is the impact of NSpgid on process signal handling?
- How can I capture a celery.signal for when a task is "queued", must include a way to access kwargs?
- Angular Signals: How to handle requests to API
- SIGCHLD handling in C socket programming
- Angular Behavior: Property Type Changes from SignalFunction to Boolean
- Is it true that the segmentation violation exception can only be triggered once?
Related Questions in KSH
- Looking for KornShell (ksh93) User Defined Type (typeset -T) documentation/examples
- Replace column values of one file with values present in another file
- String substitution with sed
- Bash Pass local file with params to remote server
- ksh behaves differently for telnet command
- SFTP - Listing files in a directory and writing the output to a .txt file
- Checking script's arguments in a function
- Conditionally bypass a command based on type of shell bash vs ksh
- Jenkins double ssh only do the fist ssh step and doesn't do all the things asked
- how to find file path where the function resides in solaris
- Replace /" from the 14th column of the file in unix shell script ksh
- ls command with human readable file size kornshell
- ksh conditional execution of timeout
- Git Bash date command ignoring TZ env
- syntax error at line and invalid reference list for the KSH script syntax
Related Questions in SHELL-TRAP
- Multiple actions in trap in ksh
- Why doesn't script call the cleanup and kill the script after 5s, and I also want to get where it stoppped
- In bash: processing every command line without using the debug trap?
- Is trap EXIT required to execute in case of SIGINT or SIGTERM received?
- How do I trap EXIT in a solaris 11 shell script?
- Trap syntax issue in bash
- shell script process termination issue
- Remove temporary files at end of bourne shell script
- shell script terminating program but not the script itself
- Exit after trap fires
- Simultaneously watch for signals and process exit in Bourne shell
- JBoss Init Script - Trapping issue
- why is this simple bash trap failing
- Restore traps without a temp file
- Idiomatic way to exit ksh while loop
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can use
killto send any signal you want to the current shell. You can useexitin a subshell orreturnin a function to set any error code you want.Try this script:
Example: