i need to accept the user input in my c shell script before executing next command. i have the following code which ask for user input, but does not store this value.
set req
echo " Enter your input(Y/N)?"
read req
if (req = Y)
echo " print $req"
else
echo " print $req"
... (3 Replies)
Dear Friends,
I am doing a sh shell script , But I dont have any idea how to read value from user Keyboard and store them to an array .. Is it possible or not I am not also sure in sh shell script ?
EX:-
#! /bin/sh
read DATA
echo "DATA -" $DATA
echo "DATA -" $DATA
echo "DATA... (7 Replies)
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)
All,
problem Description: For example: I have two shell scripts(executables). let name it as script1 and script2.I'm trying to execute script1 from script2. while executing script2, script1 is asking for manual input(input from keyboard).
Now i need to know how I can skip this user input... (3 Replies)
I want to create an array which can store the strings from the user input in shell script .
example :-
I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled.
#!/bin/sh
echo " Enter your choice to continue y/Y OR n/N to quit "
read A
if
then
echo " user requested to continue "
##some commands... (7 Replies)
How to check the user input to be valid using shell script?
The valid input is in the format like as follows.
1. It can only have r,w,x or a hyphen and nothing else.
2. ensure the r, w, x are in the correct order.
for example: rwxr-xr-x is a valid format.
Thanks (5 Replies)
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)
I still cannot figure out how to get this read command to work. I want the script to ask questions when prompted, and the user to enter a response. Based on response it will continue or exit. I have not worked with this type of script before so I am almost clueless on what to do, and so far google... (6 Replies)
Hello, I want to start out by saying that I am fairly new to scripting and am looking for someone that can point me in the right direction.
Basically what I need is a way to run a interactive script that will prompt users with questions weather that be yes/no or a specific answer.. I want to be... (3 Replies)
Discussion started by: shoutcast
3 Replies
LEARN ABOUT CENTOS
cpanplus::shell::default::plugins::howto
CPANPLUS::Shell::Default::Plugins::HOWTO(3) User Contributed Perl Documentation CPANPLUS::Shell::Default::Plugins::HOWTO(3)NAME
CPANPLUS::Shell::Default::Plugins::HOWTO -- documentation on how to write your own plugins
SYNOPSIS
package CPANPLUS::Shell::Default::Plugins::MyPlugin;
### return command => method mapping
sub plugins { ( myplugin1 => 'mp1', myplugin2 => 'mp2' ) }
### method called when the command '/myplugin1' is issued
sub mp1 { .... }
### method called when the command '/? myplugin1' is issued
sub mp1_help { return "Help Text" }
DESCRIPTION
This pod text explains how to write your own plugins for "CPANPLUS::Shell::Default".
HOWTO
Registering Plugin Modules
Plugins are detected by using "Module::Pluggable". Every module in the "CPANPLUS::Shell::Default::Plugins::*" namespace is considered a
plugin, and is attempted to be loaded.
Therefor, any plugin must be declared in that namespace, in a corresponding ".pm" file.
Registering Plugin Commands
To register any plugin commands, a list of key value pairs must be returned by a "plugins" method in your package. The keys are the
commands you wish to register, the values are the methods in the plugin package you wish to have called when the command is issued.
For example, a simple 'Hello, World!' plugin:
package CPANPLUS::Shell::Default::Plugins::HW;
sub plugins { return ( helloworld => 'hw' ) };
sub hw { print "Hello, world!
" }
When the user in the default shell now issues the "/helloworld" command, this command will be dispatched to the plugin, and its "hw" method
will be called
Registering Plugin Help
To provide usage information for your plugin, the user of the default shell can type "/? PLUGIN_COMMAND". In that case, the function
"PLUGIN_COMMAND_help" will be called in your plugin package.
For example, extending the above example, when a user calls "/? helloworld", the function "hw_help" will be called, which might look like
this:
sub hw_help { " /helloworld # prints "Hello, world!
" }
If you don't provide a corresponding _help function to your commands, the default shell will handle it gracefully, but the user will be
stuck without usage information on your commands, so it's considered undesirable to omit the help functions.
Arguments to Plugin Commands
Any plugin function will receive the following arguments when called, which are all positional:
Classname -- The name of your plugin class
Shell -- The CPANPLUS::Shell::Default object
Backend -- The CPANPLUS::Backend object
Command -- The command issued by the user
Input -- The input string from the user
Options -- A hashref of options provided by the user
For example, the following command:
/helloworld bob --nofoo --bar=2 joe
Would yield the following arguments:
sub hw {
my $class = shift; # CPANPLUS::Shell::Default::Plugins::HW
my $shell = shift; # CPANPLUS::Shell::Default object
my $cb = shift; # CPANPLUS::Backend object
my $cmd = shift; # 'helloworld'
my $input = shift; # 'bob joe'
my $opts = shift; # { foo => 0, bar => 2 }
....
}
BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>.
AUTHOR
This module by Jos Boumans <kane@cpan.org>.
COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved.
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.
SEE ALSO
CPANPLUS::Shell::Default, CPANPLUS::Shell, cpanp
perl v5.16.3 2013-05-20 CPANPLUS::Shell::Default::Plugins::HOWTO(3)