Capturing a ^C to break out of a script?
Roger Oberholtzer
roger
Mon May 17 11:33:59 PDT 2004
On Wed, 26 Jun 2002 19:11:16 -0400
Kurt Wall <kwall at kurtwerks.com> wrote:
> Also sprach James McDonald:
> >
> > Umm I was wondering if there is anyway of breaking out of a script by
> > capturing the CTRL+C combination and completey exiting the script I am
>
> You should be able to use the trap builtin (if you're using bash).
as well as sh and ksh/pdksh, which is as far as my shell use goes. I would
expect csh/zsh/tcsh all have the capability. wish uses a 'bind' command to
trap things (both real and virtual). Oddly, most people don't consider wish/tclsh when making 'shell' scripts. Too bad. Works great.
--
+============================+===============================+
| Roger Oberholtzer | E-mail: roger at opq.se |
| OPQ Systems AB | WWW: http://www.opq.se/ |
| Erik Dahlbergsgatan 41-43 | Phone: Int + 46 8 314223 |
| 115 32 Stockholm | Mobile: Int + 46 733 621657 |
| Sweden | Fax: Int + 46 8 302602 |
+============================+===============================+
More information about the Linux-users
mailing list