04-27-2009
the input can also be read by giving the following
value=$1
or read $1
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a situation where I want the user to enter only numbers in response to a READ command. I have some validation to restrict the number to be between 1 and 12, but if the user type in some characters the script echoes some error message and goes to the next command. Below is a snippet of the... (1 Reply)
Discussion started by: pvar
1 Replies
2. Shell Programming and Scripting
Dear All,
I got a table creation file in a standard format. I need to accept parameters from the user & then based on the input change the data in the file. For. eg. i will accept the database name, dbspace name & user name from the user and accordingly change the same in the table creation... (2 Replies)
Discussion started by: lloydnwo
2 Replies
3. Shell Programming and Scripting
hi,
am a new learner to shell programming.
i have a script which will prompt for user to key in their name & display their name afterwards.
script
=====
echo "Pls enter your name:"
read name
echo "Your name is $name."
output
=====
Pls enter your name:
Bob
Your name is Bob.
what... (2 Replies)
Discussion started by: newbie168
2 Replies
4. UNIX for Dummies Questions & Answers
I am trying to write a one line command for Oracle grid control. I am using a semi-colon to separate the commands. But, I am having a problem with a shell script accepting input. Wondering if you can help.
Here is what I am trying to do:
(PGPRD5432)@prd01:/> cd /export/home/postgres ##... (3 Replies)
Discussion started by: rexmabry
3 Replies
5. Shell Programming and Scripting
Hi All,
I am trying to write a script in which I need to accept multiple value in the same variable.
The case Is that I have put a FOR loop and inside the FOR loop I am accepting a variable value. And I require all the values which gets inputted in the variable.
To be... (5 Replies)
Discussion started by: rahulmittal87
5 Replies
6. Shell Programming and Scripting
Dear All,
The sqlplus 'Accept' command is not waiting for user input when I include the command within a shell script.
Note: The 'Accept' command is working fine if I execute it in a SQLPLUS Prompt.
Please fins the below sample script which i tried.
SCRIPT:
--------
#!... (4 Replies)
Discussion started by: little_wonder
4 Replies
7. UNIX for Advanced & Expert Users
I have a very weird problem with the gedit 2.30.3 text editor on GNOME 2.30.2 (Ubuntu Linux 10.04 LTS):
Any and all mouse clicks and key-presses into the gedit window are summarily ignored. When I say the gedit window, I mean the gedit window proper, the window contents, not the decoration of... (1 Reply)
Discussion started by: ropers
1 Replies
8. Programming
Hi
I want to accept multiple lines input with spaces from User and i have a working code like this.
char sRes;
char sReq;
printf("Please enter request:");
scanf("%",sReq); /* Accept the input from user */
printf("\nPlease enter response:");
scanf("%",sRes);
but the... (4 Replies)
Discussion started by: AAKhan
4 Replies
9. Shell Programming and Scripting
echo (some info) read? <&1(not working for me) (1 Reply)
Discussion started by: robin_simple
1 Replies
10. Shell Programming and Scripting
I want a shell script that accepts user input simultaneously when performing other tasks. Example: A shell script should echo some messages on the console and when the user presses some keys it should respond to that action.
say, when user presses the key
A - more information should be printed... (2 Replies)
Discussion started by: Arun_Linux
2 Replies
VKBD(4) BSD Kernel Interfaces Manual VKBD(4)
NAME
vkbd -- the virtual AT keyboard interface
SYNOPSIS
device vkbd
DESCRIPTION
The vkbd interface is a software loopback mechanism that can be loosely described as the virtual AT keyboard analog of the pty(4), that is,
vkbd does for virtual AT keyboards what the pty(4) driver does for terminals.
The vkbd driver, like the pty(4) driver, provides two interfaces: a keyboard interface like the usual facility it is simulating (a virtual AT
keyboard in the case of vkbd, or a terminal for pty(4)), and a character-special device ``control'' interface.
The virtual AT keyboards are named vkbd0, vkbd1, etc., one for each control device that has been opened.
The vkbd interface permits opens on the special control device /dev/vkbdctl. When this device is opened, vkbd will return a handle for the
lowest unused vkbdctl device (use devname(3) to determine which).
Each virtual AT keyboard supports the usual keyboard interface ioctl(2)s, and thus can be used with kbdcontrol(1) like any other keyboard.
The control device supports exactly the same ioctl(2)s as the virtual AT keyboard device. Writing AT scan codes to the control device gener-
ates an input on the virtual AT keyboard, as if the (non-existent) hardware had just received it.
The virtual AT keyboard control device, normally /dev/vkbdctl<N>, is exclusive-open (it cannot be opened if it is already open) and is
restricted to the super-user. A read(2) call will return the virtual AT keyboard status structure (defined in <dev/vkbd/vkbd_var.h>) if one
is available; if not, it will either block until one is or return EWOULDBLOCK, depending on whether non-blocking I/O has been enabled.
A write(2) call passes AT scan codes to be ``received'' from the virtual AT keyboard. Each AT scan code must be passed as unsigned int.
Although AT scan codes must be passes as unsigned ints, the size of the buffer passed to write(2) still should be in bytes, i.e.,
static unsigned int codes[] =
{
/* Make Break */
0x1e, 0x9e
};
int
main(void)
{
int fd, len;
fd = open("/dev/vkbdctl0", O_RDWR);
if (fd < 0)
err(1, "open");
/* Note sizeof(codes) - not 2! */
len = write(fd, codes, sizeof(codes));
if (len < 0)
err(1, "write");
close(fd);
return (0);
}
Write will block if there is not enough space in the input queue.
The control device also supports select(2) for read and write.
On the last close of the control device, the virtual AT keyboard is removed. All queued scan codes are thrown away.
SEE ALSO
kbdcontrol(1), atkbdc(4), psm(4), syscons(4), vt(4)
HISTORY
The vkbd module was implemented in FreeBSD 6.0.
AUTHORS
Maksim Yevmenkin <m_evmenkin@yahoo.com>
CAVEATS
The vkbd interface is a software loopback mechanism, and, thus ddb(4) will not work with it. Current implementation of the syscons(4) driver
can accept input from only one keyboard, even if it is virtual. Thus it is not possible to have both wired and virtual keyboard to be active
at the same time. It is, however, in principal possible to obtain AT scan codes from the different sources and write them into the same vir-
tual keyboard. The virtual keyboard state synchronization is the user's responsibility.
BSD
August 12, 2004 BSD