Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I issue a ctrl+c in a unix

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
US
How can I issue a ctrl+c in a unix korn shell script
I've tried: echo "^c" but this doesn't work. Can someone please tell me what the correct syntax would be? Thanks
 
In what context to you need to do a ctrl-c?

You can use exit to stop the script at any time.

Greg.
 
I am writing a script that will make sure I can telnet to a box that has an intermittent problem. When this problematic situation occurs, I can ping the box but I cant telnet to it. My script does something like:
telnet sp18 1>/tmp/telnet.out 2>&1
I then grep telnet.out for a string. The problem that I am having is that the telnet command makes the script hang(at a login prompt,of course) so, I want to send a ctrl + c sequence so that the script can continue and then exit
 
have a look at the kill command, you can use it to send an INT signal (a Control-C) to a process Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Another option is to pipe anything to the telnet.

echo "" | telnet sp18 1>/tmp/telnet.out 2>&1
 
raider - sorry to be thick, how does that work then? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top