LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-21-2016, 11:28 AM   #16
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,921

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319

Quote:
Originally Posted by Fixit7 View Post
Does not work in Slacko 6.3
I do not think that does not work. Just you need to know what will/should happen:
First, it is not Ctrl-C, but an event. The name of that event is sigint (that means sending a signal named interrupt).
To check which key will initiate this event you need to execute:
Code:
> stty -a
speed 38400 baud; rows 36; columns 96; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany
imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
And you will see it is attached to ^C (^ means Ctrl-). Also you will see another events, like sigquit, sigstop...).
Next come two questions: what will send this signal and what will catch it. Usually the terminal handler will send it and the process using that terminal will catch it (but it is configurable). There are processes which has no terminal attached, obviously you cannot send ^C to them. But - obviously - you can explicitly send signal to any process using the command kill. Background processes .... read man bash, look for job control.

And return back to your original post: exactly what did not work for you?
 
Old 03-21-2016, 11:33 AM   #17
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Refer to:
Quote:
Originally Posted by cnamejj View Post
This thread is ancient, revived by accident I suppose. Deleting my comments to avoid tricking others into continuing this.
Quote:
Originally Posted by chrism01 View Post
Guys,

can I just point out that the qn & my prev responses are from 2010 ...
 
Old 03-21-2016, 12:43 PM   #18
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Ctrl C stops a script if started from a console.

But not from the desktop.
 
Old 03-21-2016, 12:51 PM   #19
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by Fixit7 View Post
Ctrl C stops a script if started from a console.

But not from the desktop.
Hi Andy,

Do you realize that any earlier activity in the thread before your post, post #7, there was no activity in this thread since 2010?

Was there a new discovery which led to resurrecting this thread? Or was it an attempt to answer what you thought to be a current question?

Note that very old threads do not pull up the Quick Reply window and you have to click on the Post Reply button, and the next step is that LQ posts a notification:
Quote:
Please note that this thread has not been replied to in over 6 months. Please ensure your reply is still relevant and timely.
Repeated not in red coloring:
Quote:
Please note that this thread has not been replied to in over 6 months. Please ensure your reply is still relevant and timely.
Best Regards,

- RT
 
Old 03-21-2016, 01:09 PM   #20
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Quote:
Do you realize that any earlier activity in the thread before your post, post #7, there was no activity in this thread since 2010?

Was there a new discovery which led to resurrecting this thread? Or was it an attempt to answer what you thought to be a current question?
I knew it was an old thread.

I searched for an answer and found the thread.

It was an attempt to find an answer as well as saving some typing. :-)

Last edited by Fixit7; 03-21-2016 at 01:12 PM.
 
Old 03-21-2016, 02:40 PM   #21
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Moderator note: I have split this thread from the old one. We prefer to have an up-to-date thread for different questions and you already have a quite high number of answers not related to the old one.
 
Old 03-21-2016, 02:54 PM   #22
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,921

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
Quote:
Originally Posted by Fixit7 View Post
Ctrl C stops a script if started from a console.

But not from the desktop.
That's what I tried to explain. Desktop is not a terminal there is no way to identify the process to get the signal. (also graphical processes like editors use Ctrl-C Ctrl-V for copy and paste). In short you need to take care about the focus too.
 
1 members found this post helpful.
Old 03-21-2016, 03:02 PM   #23
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by Fixit7 View Post
Ctrl C stops a script if started from a console.

But not from the desktop.
Per pan64's comments. When started from the desktop there is no terminal attached to your script process. Therefore you need to run a terminal and observe the process list, then kill the script in that manner.

If you are looking for an automated way to kill a script, then please indicate that and people can suggest ways to write programs or scripts to do the seeking out for the script process and killing it. The most simplest script might be:
Code:
#Example process name my-script.sh
#!/bin/bash
killall my-script.sh
Or even:
Code:
#!/bin/bash
killall $1
 
Old 03-21-2016, 05:56 PM   #24
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Solved
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
emacs in a terminal : problems with ctrl Willard Linux - Software 5 09-13-2011 04:18 PM
How to disable Ctrl+C, Ctrl+V, Ctrl+X in rdesktop? Aswathy Linux - Newbie 1 01-19-2011 06:22 PM
[SOLVED] vim:ctrl+v command to select some data.But when I push ctrl+v.It doesn't work.. e3399 Linux - Newbie 20 12-07-2010 06:21 AM
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 09:23 AM
Any way to create bash short cuts (like CTRL+l for clear and Ctrl+D for exit) supersubu123 Linux - General 5 05-30-2007 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:50 AM.

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