Capturing key strokes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capturing key strokes
# 1  
Old 12-01-2008
Capturing key strokes

I have a shell script and i want to capture the key strokes in that script while that script is in running state.
For example During the running of the process , if i press CTRL+Z i need to capture those key strokes in that script.
Any idea pls.

Regards,
ORK
# 2  
Old 12-01-2008
trap is basicly what u are looking for. but imho you cannot trap a control-z signal
# 3  
Old 12-01-2008
Have a look at 'script'. It may be installed by default; if not, you should be able to acquire it through your package manager.
# 4  
Old 12-01-2008
You can capture any character, including control Z. However you can't capture other keys like "shift". If a user simply taps the "shift" key, say, 3 times. nothing is sent to the system. For an example of capturing characters, see: https://www.unix.com/shell-programmin...character.html
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

2. Solaris

Solaris 8 ssh public key authentication issue - Server refused our key

Hi, I've used the following way to set ssh public key authentication and it is working fine on Solaris 10, RedHat Linux and SuSE Linux servers without any problem. But I got error 'Server refused our key' on Solaris 8 system. Solaris 8 uses SSH2 too. Why? Please help. Thanks. ... (1 Reply)
Discussion started by: aixlover
1 Replies

3. Shell Programming and Scripting

Capturing Particular Data

Hi everyone! Can any one help me out regarding capturing relevant data from a file. For e.g, if i want to capture the comment written after "Prompt:" for a particular date, like for this case what would be the command to capture the tag written after "Prompt:" for Date: 2009-03-20. A... (7 Replies)
Discussion started by: muhmsida
7 Replies

4. UNIX for Dummies Questions & Answers

Capturing a value in to variable.

Hi, I currently have a shell script where it captures in the value in to 'TOTAL' and outputs to a file, i want to capture another value of a query in to another variable and output it. Current script: sqlplus -s $user <<EOD | read TOTAL set heading off set pages 0 set feedback off set... (1 Reply)
Discussion started by: ravi0435
1 Replies

5. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

6. Cybersecurity

SSH key code versus server key code

Hi, When logging in using SSH access (to a remotely hosted account), I received a prompt to accept a server's key fingerprint. Wrote that string of code down for comparision. Already emailed my host for their listing of the string of code for the server's key fingerprint (for comparison,... (1 Reply)
Discussion started by: Texan
1 Replies

7. Shell Programming and Scripting

Capturing value into variable

Hi, I am new to shell scripting, I am trying to write a shell script, which will automate the process of mailing the invoices at the end of the day. For major part I am using Oracle database function. The problem is I want to capture the value returned by the Oracle function into the script... (2 Replies)
Discussion started by: prasad01
2 Replies

8. Programming

Keyboard Strokes w/o Delay...

Hello(again), but I was wondering how you would obtain a keyboard stroke from a user with no delay(they don't have to hit enter) and then place that stroke into a variable? Lets say you tell the user to hit, on the numpad, a number. Then that number is placed into a variable w/o the user hitting... (2 Replies)
Discussion started by: mbolthouse
2 Replies
Login or Register to Ask a Question