LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-10-2011, 03:22 PM   #1
Rmurphy
LQ Newbie
 
Registered: Oct 2011
Posts: 6

Rep: Reputation: Disabled
how to modify my file adding a trap for SIGINT and SIGTERM


HELP Please!!!!

I have to modify the following script to add a trap for SIGINT and SIGTERM, save it and run it in the background. I have no clue and searching on the net isn't helping and my book isn't helping.

Here is my code

#!/bin/bash
count=1
echo "start of the program"
while [ $count -le 10 ]
do
echo "Loop #$count"
sleep 10
count=$[ count + 1 ]
done
echo "end of the program"
 
Old 10-10-2011, 04:01 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
1st hit on google 'bash trap' http://tldp.org/LDP/Bash-Beginners-G...ect_12_02.html

You should bookmark these
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
0 members found this post helpful.
Old 10-10-2011, 04:20 PM   #3
Rmurphy
LQ Newbie
 
Registered: Oct 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
I have been to those pages except for 1 it gave me a 404 error in the browser. I do not know how to write the command properly for it execute the way it should.
 
Old 10-10-2011, 09:13 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,424

Rep: Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823
So based on the first link in chrism01's post, what are you confused about?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify file name by adding a sequence number turnvinal Programming 6 10-19-2011 11:00 AM
how to send snmp trap & recieve trap in C program minil Programming 3 07-10-2010 10:22 AM
in bash does control-c = SIGINT or SIGTERM? walterbyrd Linux - General 2 05-09-2006 12:01 PM
Linux - Bash - Trap SIGTERM bigdogdan2 Programming 13 07-20-2004 11:54 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 04:34 AM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration