PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > ctrl z question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

ctrl z question

Réponse
 
LinkBack Outils de la discussion
Vieux 30/05/2007, 07h02   #1
merrittr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ctrl z question




can I trap ctrl-z and displa a message??? this doesn't seem to work:
trap "echo You\'re trying to Control-z me" SIGTSTP

  Réponse avec citation
Vieux 31/05/2007, 20h15   #2
Jose H.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ctrl z question

On May 30, 12:02 am, merrittr <merri...@gmail.com> wrote:
> can I trap ctrl-z and displa a message??? this doesn't seem to work:
> trap "echo You\'re trying to Control-z me" SIGTSTP


man bash
...........

SIGNALS
When bash is interactive, in the absence of any traps, it
ignores SIGTERM (so that kill 0 does not kill an interac-
tive shell), and SIGINT is caught and handled (so that the
wait builtin is interruptible). In all cases, bash
ignores SIGQUIT. If job control is in effect, bash ignores
SIGTTIN, SIGTTOU, and SIGTSTP.

  Réponse avec citation
Vieux 03/06/2007, 06h00   #3
merrittr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ctrl z question

On May 31, 1:15 pm, "Jose H." <jose...@gmail.com> wrote:
> On May 30, 12:02 am, merrittr <merri...@gmail.com> wrote:
>
> > can I trap ctrl-z and displa a message??? this doesn't seem to work:
> > trap "echo You\'re trying to Control-z me" SIGTSTP

>
> man bash
> ..........
>
> SIGNALS
> When bash is interactive, in the absence of any traps, it
> ignores SIGTERM (so that kill 0 does not kill an interac-
> tive shell), and SIGINT is caught and handled (so that the
> wait builtin is interruptible). In all cases, bash
> ignores SIGQUIT. If job control is in effect, bash ignores
> SIGTTIN, SIGTTOU, and SIGTSTP.


ok
SIGSTP is the one I want to trap So your saying Job Control is the
key? I can't seem to se how to disable it

  Réponse avec citation
Vieux 03/06/2007, 20h57   #4
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ctrl z question

In article <1180846807.342313.161110@j4g2000prf.googlegroups. com>,
merrittr <merrittr@gmail.com> wrote:

> On May 31, 1:15 pm, "Jose H." <jose...@gmail.com> wrote:
> > On May 30, 12:02 am, merrittr <merri...@gmail.com> wrote:
> >
> > > can I trap ctrl-z and displa a message??? this doesn't seem to work:
> > > trap "echo You\'re trying to Control-z me" SIGTSTP

> >
> > man bash
> > ..........
> >
> > SIGNALS
> > When bash is interactive, in the absence of any traps, it
> > ignores SIGTERM (so that kill 0 does not kill an interac-
> > tive shell), and SIGINT is caught and handled (so that the
> > wait builtin is interruptible). In all cases, bash
> > ignores SIGQUIT. If job control is in effect, bash ignores
> > SIGTTIN, SIGTTOU, and SIGTSTP.

>
> ok
> SIGSTP is the one I want to trap So your saying Job Control is the
> key? I can't seem to se how to disable it


Are you having the problem in a script or are you just typing the "trap"
command in an interactive shell? Scripts don't usually have job control
enabled in the first place.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Vieux 04/06/2007, 05h28   #5
merrittr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ctrl z question

it is in a script, and the ctrl z is disabled by the command however I
was hoping that when
a ctrl-z was entered a message would be displayed. The previous poster
had me thinking
that job control plays a role


#!/bin/bash

trap "echo You\'re trying to Control-z me" SIGTSTP



  Réponse avec citation
Vieux 05/06/2007, 02h01   #6
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ctrl z question

In article <1180931335.461414.61640@i38g2000prf.googlegroups. com>,
merrittr <merrittr@gmail.com> wrote:

> it is in a script, and the ctrl z is disabled by the command however I
> was hoping that when
> a ctrl-z was entered a message would be displayed. The previous poster
> had me thinking
> that job control plays a role
>
>
> #!/bin/bash
>
> trap "echo You\'re trying to Control-z me" SIGTSTP


It works for me with this script:

#!/bin/bash

trap "echo You\'re trying to Control-z me" SIGTSTP
while :; do
:
done

$ ./test.sh
<press C-z>
You're trying to Control-z me

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h42.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11940 seconds with 14 queries