LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2005, 10:02 PM   #1
JoannesX
Member
 
Registered: Dec 2004
Location: Brazil
Distribution: Slackware
Posts: 99

Rep: Reputation: 15
I need to disable ESC ...


hello guys!

Ok, I just need to disable the ESC key while running a script..
I don't want it to close my dialog boxes.. please help!!!

I've already used the trap command to block the kill signals and to block CTRL + C from closing the script..
But what I really want is that the script goes til the end with no kind of keyboard interruption!

Please, help! thanks

Last edited by JoannesX; 02-22-2005 at 12:55 PM.
 
Old 02-21-2005, 11:07 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
ESC is not a character supposed to interrupt shell scripts.
Can you explain more ?
 
Old 02-22-2005, 10:53 AM   #3
JoannesX
Member
 
Registered: Dec 2004
Location: Brazil
Distribution: Slackware
Posts: 99

Original Poster
Rep: Reputation: 15
no it surely does not stop or close or kill shell scripts..
but it closes DIALOG BOXES.. and that is my problem, you know?

for example:

Code:
dialog --msgbox "This is the text that appears in the dialog" 10 30
and the option that appears in the dialog box is only the OK button.

BUT if I press ESC, the dialog closes..
 
Old 02-22-2005, 11:19 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Try that one:
Code:
code=$(xmodmap -pk | grep "(Escape)" | nawk '{print $1}')
if [ "$code" -gt 0 ]
then
        xmodmap -e "keycode $code = Space Escape"
fi
dialog --msgbox "This is the text that appears in the dialog" 10 30
if [ "$code" -gt 0 ]
then
        xmodmap -e "keycode $code = Escape"
fi
Beware that the key mapping is not restricted to the dialog window, but affect the whole X11 server ...
You can still use Shift-escape with my mapping.
 
Old 02-22-2005, 01:05 PM   #5
JoannesX
Member
 
Registered: Dec 2004
Location: Brazil
Distribution: Slackware
Posts: 99

Original Poster
Rep: Reputation: 15
thank you for the replies!
hmm.. I wrote my script as you said...
but take a look at what I got after pressing ESC:

Code:
/ext3/scripts/shell/justtest: line 9: [: : integer expression expected
what is it?

anyway, thank you for the xmodmap instruction! (didn't know about that)
there's valuable info there...
 
Old 02-22-2005, 02:48 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
What gives
Code:
xmodmap -pk | grep -i escape
?
 
Old 02-22-2005, 04:34 PM   #7
JoannesX
Member
 
Registered: Dec 2004
Location: Brazil
Distribution: Slackware
Posts: 99

Original Poster
Rep: Reputation: 15
well,
the keycode is 9
and the keysym is 0xff1b
check it

Code:
JOANNES=[Online]=>xmodmap -pk | grep -i escape
      9         0xff1b (Escape)
 
Old 02-23-2005, 04:46 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
The problem was probably due to my script using nawk vs awk, anyway that should work:
Code:
xmodmap -e "keycode 9 = Space Escape"
dialog --msgbox "This is the text that appears in the dialog" 10 30
xmodmap -e "keycode 9 = Escape"
 
  


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
VI: Alternative to ESC ? ultraman Linux - General 3 12-09-2004 01:45 AM
ctrl + alt + esc kde, its not there cheater1034 Linux - Software 1 09-13-2004 11:22 PM
Ctrl-Alt-Esc keys Mojojo Linux - General 3 07-02-2003 03:26 PM
Analog of Ctrl+Esc chem1 Linux - Software 5 06-06-2003 08:48 PM
Damn 'Esc' key crabboy General 1 05-15-2001 10:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:20 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