Clearly /dev/input/event3 is not a text file and therefore not suitable for reading with a Shell read. In fact there is little of interest to Shell programmers under /dev. (Yep I know about /dev/null etc.).
Be very very careful in /dev - it is remarkably easy to destroy your system.
What is the output from:
(Googling the device suggests that it might be a keyboard device on some versions of Linux - a fact of little use to Shell programmers).
What Operating System and version are you running?
What Shell are you running?
What are you trying to do? Can you explain the Project in words just in case there is a stock solution?
There will be kernel driver software between Shell and a keyboard.
If you have "bash" there is a Shell raw "read" with a timeout but even then it will not register keys like ctrl and shift as characters. Reading characters in a tight loop without timeout is CPU-intensive.
A common way to modify the behaviour of a cleverly designed running Shell script is to create a flag file or to use a Shell "trap" to react to a keyboard control code or signal.
What is an "initramfs script", what does it do, and why would you want to interrupt it?
What runstate are you in while this script is running?
Now, here's my problem. I'm trying to unlock my encrypted system disk in Ubuntu 10.10. Sometimes I want to enter the passphrase via SSH and sometimes locally. Here's the piece of code that needs to be modified.
I need the script to run the first case if I want to enter the passphrase via the local keyboard, and run the second case if I want to enter the passphrase via SSH.
So, how do I notify the computer that I am at the keyboard? By pressing a key, perhaps.
Hi
I have tried to disable the CTRL-Z key inside a shell(sh) script using the command trap "`echo "Ctrl-Z key disabled"`" 20But I am not able to exit from the script after pressing CTRL-Z key.
How to proceed this? Need reply soon (11 Replies)
Hi all,
My query is... in the runtime, you are getting any input string. Unfortunately, you have pressed some ctrl keys or esc keys or arrow keys while typing input string. You can get the input value like that...
input string as
welcome^
So ,I want to remove those unwanted keys... (4 Replies)
Hello,
We are having a problem with running dtterm off a RHEL server. Logging into an HP-UX server from a RHEL 5.1 desktop, setting DISPLAY and running dtterm, the caps lock does not work. We have been playing with xmodmap & stty but to no avail.
Any help appreciated.
mgb (1 Reply)
Hello,
We are having a problem with running dtterm off a RHEL server. Logging into an HP-UX server from a RHEL 5.1 desktop, setting DISPLAY and running dtterm, the caps lock does not work. We have been playing with xmodmap & stty but to no avail.
Any help appreciated.
mgb (7 Replies)
My problem is that i have to connect Linux server. I can connect it with SSH but because of the software of the Linux server, i need to press enter and after ctrl+D. Therefore, I need to write a script that should press enter and ctrl+D. How can i write it in KSH shell script. HELP ME! (7 Replies)
Hello,
Not sure if this is the right place to post it but..
I have a requirement to set Caps lock and/or Num lock on and off via a Cron job.
Now I have working scripts that do the job, but as soon as X starts up the jobs no longer run (well they appear to, but Caps lock and Num lock do not... (0 Replies)
hi all
this s quite a foolish problem. I seem to hav pressed some keys s.t in unix, my letters are comin in caps and with caps lock on, i am getting lowercase letters. :o
Pls help.
Also is there any reference or manual where i can check in case such problems arrise?
thanx in advance
curiosity (4 Replies)
I want to detect key pressed in my .cgi web page, but it does not work even I found the code in other web site.
My code is :
#!/bin/sh
#=================================================
# PATH defination
# ================================================... (2 Replies)
With use of sed/awk, how can I print all possible combinations of a word with caps/non-caps.
Eg
Applying operation on "cap" should generate output as follows.
cap
CAP
Cap
cAp
caP
CAp
cAP
CaP (12 Replies)
Discussion started by: anil510
12 Replies
LEARN ABOUT BSD
shlock
SHLOCK(1) General Commands Manual SHLOCK(1)NAME
shlock - create lock files for use in shell scripts
SYNOPSIS
shlock -p pid -f name [ -b ] [ -u ] [ -c ]
DESCRIPTION
Shlock tries to create a lock file named name and write the process ID pid into it. If the file already exists, shlock will read the
process ID from the file and test to see if the process is currently running. If the process exists, then the file will not be created.
Shlock exits with a zero status if it was able to create the lock file, or non-zero if the file refers to currently-active process.
OPTIONS-b Process IDs are normally read and written in ASCII. If the ``-b'' flag is used, then they will be written as a binary int. For
compatibility with other systems, the ``-u'' flag is accepted as a synonym for ``-b'' since binary locks are used by many UUCP pack-
ages.
-c If the ``-c'' flag is used, then shlock will not create a lock file, but will instead use the file to see if the lock is held by
another program. If the lock is valid, the program will exit with a non-zero status; if the lock is not valid (i.e., invoking
shlock without the flag would have succeeded), then the program will exit with a zero status.
EXAMPLES
The following example shows how shlock would be used within a shell script:
LOCK=/var/run/innd/LOCK.send
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
if shlock -p $$ -f ${LOCK} ; then
# Do appropriate work
else
echo Locked by `cat ${LOCK}`
fi
HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> after a description of HDB UUCP locking given by Peter Honeyman. This is revision 1.9, dated
1996/10/29.
SHLOCK(1)