The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[C] fgets problem with SIGINT singlal!!! hurricane86 High Level Programming 1 01-02-2009 12:04 PM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 01:25 PM
Problem with handling SIGINT JamesGoh High Level Programming 3 02-24-2008 10:39 PM
Cannot catch SIGINT while serial break condition occurs gzz High Level Programming 13 11-23-2007 08:06 AM
AIX intercepting system calls ramkumar.pvs AIX 2 09-29-2006 03:17 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-01-2009
Starcast Starcast is offline
Registered User
  
 

Join Date: Jan 2009
Location: Minneapolis, MN
Posts: 13
Intercepting SIGINT in a bash script

I've written a bash script which captures video with DVgrab. Because of the nature of the tapes that I am digitizing, sometimes I want to quit capturing before the time that I set for DVgrab. When this is the case I press Ctrl-c and DVgrab exits cleanly, my problem is that there is additional information that the script prints in the terminal with 'echo' when the script runs till it's set time. When I Ctrl-c none of this information prints...

Is there a way to intercept the SIGINT ( I think this is what I want, but I could be wrong) and have it operate exactly as it does by default, but additionally echo a few varibles in the terminal?

Preferably I would like to do this just in my script... and not effect the way Ctrl-c functions system wide.

Not sure if it matters, but based on my reading prior to this post I wasn't sure, but I run this script in a virtual terminal in gnome on an Ubuntu (8.10) Linux machine

The bit that I wanted to add when Ctrl-c is pressed looks like this:


Code:
echo -e "\E[31;40m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+               Warning - Capture Ended Early                           +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo -e "\E[30;47m++ Format: $FORMAT    ++ Min Remaing on $destination : $minremain    "
echo "++ Deck: $deck_number          ++ Customer: $customer      " 
echo "++ Rec Time: $tape_length  ++ Tape: $tapename"

Thanks in advance!
-Starcast
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0