Operating System - HP-UX
1834920 Members
2889 Online
110071 Solutions
New Discussion

control c break not working

 
Tong Hu_1
Occasional Advisor

control c break not working

We have stty intr "^c" setup in the .profile, but control c is not always working. It is working for cat more command, but if we use tail -f /var/adm/syslog/syslog.log, then the break function is not working. Can anybody help please?

Thank
Tony
7 REPLIES 7
Michael Steele_2
Honored Contributor

Re: control c break not working

Control C = kill -2 or SIGHUP or hangup.

There are other options.

control-D (* EOF?? *)
control \ (* not sure but it often terminates sessions *)
shift-] (* close telnet session and quit *)
Support Fatherhood - Stop Family Law
sysadm_1
Valued Contributor

Re: control c break not working

Try cntrl+break key or simple break key
Tong Hu_1
Occasional Advisor

Re: control c break not working

none of them working only except control ], which is disconnect the network. Any other suggestions?

Thanks
Umapathy S
Honored Contributor

Re: control c break not working

Tony,
Check the stty entries.

$ stty
speed 9600 baud; -parity hupcl
min = 1; time = 1; intr = ^C; erase = DEL; kill = ^U;
susp = ^Y;
brkint -inpck -istrip icrnl onlcr tab3
-iexten echo echoe echok
-echoctl -echoke

$stty intr ^C.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Graham Cameron_1
Honored Contributor

Re: control c break not working

Or it could be that something on your network is intercepting the ^C.
Try this, in vi insert mode:
Type ^V^C (control-v, control-c). You should see a ^C on the screen, and if you save the file and run "od -cb FILE" you should see the first byte is 003.
If not, talk to your network guys.
-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Jordan Bean
Honored Contributor

Re: control c break not working


I willing to bet 10 points that you're setting an interrupt trap in your profile. The more command resets these traps, but tail does not. To check, simple enter:

trap

You should see something like this:

trap -- '' INT

Look for any traps in /etc/profile and .profile.

Tong Hu_1
Occasional Advisor

Re: control c break not working

We have trap command in /etc/profile as trap "" 1 2 3
trap "echo logout" 0
trap 1 2 3

The output of the trap is
0:echo 'logout root'
1:
2:
3:

And also the other machines have the same setup, but don't have this issue.

For Graham's response, the output is
0000000 ^ V ^ C \n
136 126 136 103 012
0000005
This is also the same as the other setup, the other machines are working fine to use control c to break the tail -f.

I still don't understand, but thanks for your help.

Regards,
Tony