LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-13-2011, 12:48 PM   #1
IgnitusBoyone
LQ Newbie
 
Registered: Jan 2007
Location: Memphis, TN
Distribution: Gentoo 11
Posts: 13

Rep: Reputation: 0
Bash quits on ^C


Our machines at work run RHEL and default to ksh which while workable is not my prefered shell. However, when I use chsh to change my default shell to bash I get a behavior I have never experinced.

When you login with the adjusted settings bash no longer captures the control-c, but instead passes it directly to the system which exits the bash session instead of the more usual behavior where bash drops the current line and returns to a new prompt.

Now, if you change the default shell back to ksh and login then start a new bash session everything works fine, so I am working under the assumption that a Enviroment or sh variable is not being set correctly when bash is the default shell. Possibly a profile script being skipped.

Does anyone know what specific variable might be missing so I can add it to .bashrc or .bash_profile
 
Old 07-13-2011, 03:15 PM   #2
hda7
Member
 
Registered: May 2009
Distribution: Debian wheezy
Posts: 252

Rep: Reputation: 31
The problem is not that bash is passing the key to the system, but that the system is not passing the key to bash. The keyboard driver, which first handles the keystrokes, is what translates some of them into signals sent to the process (in this case, ^C produces a sigterm). Bash uses library functions to change the keyboard driver's settings. One of the variables described in http://www.gnu.org/software/bash/man...Bash-Variables may cause bash to change this.
 
Old 07-13-2011, 03:46 PM   #3
IgnitusBoyone
LQ Newbie
 
Registered: Jan 2007
Location: Memphis, TN
Distribution: Gentoo 11
Posts: 13

Original Poster
Rep: Reputation: 0
Ok, this took me a while. One of the systems profiles was changing the trap settings. I thought it was a stty setting that would of done this. Thanks for the documentation. I had been searching for solutions using the wrong symptoms and keywords. Like you said by default bash should just ignore SIGINT, so the problem was that a trap for SIGINT had been set and not that it wasn't trapping it at all.

grep trap /etc/profile*
/etc/profile:trap "exit" 1 2 3 9 15
/etc/profile.bak:trap "exit" 1 2 3 9 15
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
SeaMonkey Quits on it's own! amacg3 Puppy 20 07-27-2009 09:23 AM
audacity quits catworld Linux - Software 3 01-18-2007 12:36 AM
display quits out msander379 Linux - Newbie 1 05-18-2006 05:01 PM
Boot quits John Manion Linux - Newbie 2 10-10-2003 02:49 PM
xine quits on me? riddlebox80 Linux - Software 1 04-05-2003 05:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:37 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
Open Source Consulting | Domain Registration