I'm trying to use a bash script for a psych experiment that involves listening to sound files and responding. If I have something like the code below, how can I make sure that a key press is assigned to RESPONSE only after the second echo statement?
Also, maybe this is the same question, but how can I make sure that if there are accidentally two or more key presses, that the extra presses are ignored instead of getting assigned to RESPONSE on the next iteration(s)?
I am trying to create a shell (ksh) which has two "read" commands, one which reads a line from a file and another which is inside a loop that reads user input from a keyboard. However, the "read" command inside the loop uses the input from the file and it does not get the user input from keyboard.... (3 Replies)
Hello all,
How can i have a user input that reads like this:
echo -n "Please enter a & b:" 10 20
read a
read b
echo $a
echo $b
10
20
right now i have divided it into two echos, like
echo -n "a: "
echo -n "b: " (1 Reply)
I'm trying to set up a script that takes user input and validates that the user input was entered correctly.
So far I have this:
while :
do
echo "Please enter your name."
read NAME
if
then
echo "You have not entered a name."
echo... (13 Replies)
If I want all user input to start with " : " if not display error
or what I asking is how to do if statement that control a first letter of string that we want to start with. and not worry about the rest
Thank (1 Reply)
Hi,
echo "Enter file name of input file list along with absolute path : "
read inputFileList
if
then
for string in `cat inputFileList`
do
echo $string
done
else
echo " file does not exist"
fi
From the above code, if the user enters a invalid file... (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)
$Input_filename=$ARGV;
if (!-d $Input_filename && ! -e $Input_filename)
{
print "USAGE: Please enter '$ABCD/def/dsed.txt' as an arguement \n";
exit;
}
1. Input Is suppose to be something like "$ABCD/def/dsed.txt".
if the input is wrong the script should throw an ERROR message.... (2 Replies)
Why does removing "rhgb quiet" from the kernel boot parameters control whether or not the commands I enter are displayed in single user mode ?
For instance, if I do not remove "rhgb quiet", when I am in single user mode, whatever command I type will not be displayed on the screen.
The... (0 Replies)
I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :).
The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies
LEARN ABOUT DEBIAN
net::sip::request
Net::SIP::Request(3pm) User Contributed Perl Documentation Net::SIP::Request(3pm)NAME
Net::SIP::Request - handling of SIP request packets
SYNOPSIS
my $req = Net::SIP::Request->new( 'INVITE',... );
my $ack = $req->create_ack();
DESCRIPTION
Subclass of Net::SIP::Packet for handling request packets. Has methods to create responses to requests and to authorize requests.
EXAMPLES
# create INVITE request
my $invite = Net::SIP::Request->new(
'INVITE', 'sip:you@example.com',
{ from => ..., to => ... },
Net::SIP::SDP->new( ... )
);
# somehow send request and retrieve response $resp
...
if ( $resp->code eq '401' or $resp->code eq '407' ) {
# need to authorize request
$invite->authorize( $resp, [ username, password ] );
# somehow send again and retrieve response $resp
...
}
if ( $resp->code ~m{^[2345]dd} ) {
# got final response, send ACK
my $ack = $invite->create_ack( $resp );
# somehow send $ack
...
}
CONSTRUCTOR
Inherited from Net::SIP::Packet. See there.
METHODS
method
Get method of request.
uri Get URI part of request.
set_uri ( STRING )
Set URI of request to STRING
set_cseq ( NUMBER )
Set sequence number if "CSeq" header to NUMBER.
create_ack ( RESPONSE )
Returns Net::SIP::Request object for ACK request for the case when Net::SIP::Response RESPONSE was received in reply for packet $self.
create_cancel
Returns Net::SIP::Request object to cancel request in $self.
create_response ( CODE, [MSG,] [ \%HEADER, BODY ] )
Returns Net::SIP::Response packet for the received request $self with numerical code CODE and text message MSG. Header for the response
will be based on the request, but can be added or overridden using \%HEADER. If MSG is not given (e.g. argument is missing, second
argument is \%HEADER already) a builtin message for the code will be used.
For details to \%HEADER and BODY see new_from_parts in Net::SIP::Packet.
authorize ( RESPONSE, AUTH )
Tries to authorize request $self based on the information in RESPONSE (a 401 or 407 "Authorization required" response) and AUTH. AUTH
is either "[ user,pass ]" if a global authorization info exists for all realms or "{ realm1 => [ user1,pass1 ], realm2 => [ user2,pass2
],... }" if different credentials are provided for different realms or a callback "callback(realm)->[user,pass]". The realms, for
which authorization is needed, are read from RESPONSE.
The request $self is modified in-place. If a modification occurred, e.g. if (parts of) the authorization requests could be resolved it
will return TRUE, else FALSE.
Supports only RFC2617 with md5 and empty qop or qop 'auth', not md5-sess or qop's like 'auth-int'.
perl v5.14.2 2012-06-26 Net::SIP::Request(3pm)