04-26-2009
echo "Enter the input"
read input # it has the input you type in the KB and hit enter
echo "read"
cheers,
Devaraj Takhellambam
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
LEARN ABOUT PHP
readline_callback_handler_install
READLINE_CALLBACK_HANDLER_INSTALL(3) 1 READLINE_CALLBACK_HANDLER_INSTALL(3)
readline_callback_handler_install - Initializes the readline callback interface and terminal, prints the prompt and returns immediately
SYNOPSIS
bool readline_callback_handler_install (string $prompt, callable $callback)
DESCRIPTION
Sets up a readline callback interface then prints $prompt and immediately returns. Calling this function twice without removing the previ-
ous callback interface will automatically and conveniently overwrite the old interface.
The callback feature is useful when combined with stream_select(3) as it allows interleaving of IO and user input, unlike readline(3).
PARAMETERS
o $prompt
- The prompt message.
o $callback
- The $callback function takes one parameter; the user input returned.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
Example #1
Readline Callback Interface Example
<?php
function rl_callback($ret)
{
global $c, $prompting;
echo "You entered: $ret
";
$c++;
if ($c > 10) {
$prompting = false;
readline_callback_handler_remove();
} else {
readline_callback_handler_install("[$c] Enter something: ", 'rl_callback');
}
}
$c = 1;
$prompting = true;
readline_callback_handler_install("[$c] Enter something: ", 'rl_callback');
while ($prompting) {
$w = NULL;
$e = NULL;
$n = stream_select($r = array(STDIN), $w, $e, null);
if ($n && in_array(STDIN, $r)) {
// read a character, will call the callback when a newline is entered
readline_callback_read_char();
}
}
echo "Prompting disabled. All done.
";
?>
readline_callback_handler_remove(3), readline_callback_read_char(3), stream_select(3).
PHP Documentation Group READLINE_CALLBACK_HANDLER_INSTALL(3)