I am trying to code an if statement that accepts two parameters and see if those parameters are in another file called teledir.txt. If it already exists in the file, it is to say "Entry Exists". If not, I add it to the file and say "Entry Added". This is the code I have so far:
When I run this, if I enter a name and number that is in the file, it says entry added and places it into the file. I'm new to the command line but what am I missing?
HPUX11.0/Korn Shell
I have an old script that takes in a series of arguments when its called. The script is really more of a common set of functions that gets called by other scripts as needed. I have been asked to make this into a menu driven script to rollout to app support for their use during... (2 Replies)
Hello,
I am using the Bourne shell.
I am trying to understand the concept of positional parameters.
I do understand that positional parameters:
1. Are initialized by shell
2. Have a max of 9 parameters ($1 to $9)
3. Have no limit on the number of arguments
4. Can be rearranged... (15 Replies)
I need to get file names from commandline arguments, it may be any no of arguements, Using for loop i got but how do i display it, bcoz $i will give the number i is assigned $$i is not working either $($i), i need the names of the files got in the arguement (2 Replies)
Hi,
Can any one provide the Unix command to reset the positional parameters?
Please see the below example where i have to pass 2 parameters to Shell1.sh.
Step1) . ./Shell1.sh 2 3
successfully executed, Then i executed(next step only) the same shell script again,this time no... (4 Replies)
Hi all,
I have one small requirment...
I have prepared one script. we have to pass two possitional parameters to the script. What I want to do is if the parameters are not passed then i dont want the script to start the process...
For ex:
$ ./a.sh parm1 parm2
#Here, it can start... (7 Replies)
In a Bash script I used getopts command to let a user does something regards to the selected options. The question is: How do you find out what is the name of the file that user inserted in the command line like the following:
The good part is this file is always the last argument in the... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
STEP 1: Create a Bash shell script (myscript) inside the a2 directory. The script should allow the user to pass... (3 Replies)
I like to “optimize” / make more like a real program my bash script by replacing repetitious code which utilizes positional parameters.
I am having two issues I cannot solve and would appreciate some assistance with resolving them.
a) how to modify the whiptail checklist... (3 Replies)
I'm new with 'sed' and for sure something still I don't understand yet with it. If you see my output on ">Output..." portion, the new directory still on "source_dir" instead of "dest_dir". You may disregard for the "tar" part, this is just a test script, just for me to understand 'sed' using the... (3 Replies)
Discussion started by: daryl0505
3 Replies
LEARN ABOUT CENTOS
spi_prepare
SPI_PREPARE(3) PostgreSQL 9.2.7 Documentation SPI_PREPARE(3)NAME
SPI_prepare - prepare a statement, without executing it yet
SYNOPSIS
SPIPlanPtr SPI_prepare(const char * command, int nargs, Oid * argtypes)
DESCRIPTION
SPI_prepare creates and returns a prepared statement for the specified command, but doesn't execute the command. The prepared statement can
later be executed repeatedly using SPI_execute_plan.
When the same or a similar command is to be executed repeatedly, it is generally advantageous to perform parse analysis only once, and
might furthermore be advantageous to re-use an execution plan for the command. SPI_prepare converts a command string into a prepared
statement that encapsulates the results of parse analysis. The prepared statement also provides a place for caching an execution plan if it
is found that generating a custom plan for each execution is not helpful.
A prepared command can be generalized by writing parameters ($1, $2, etc.) in place of what would be constants in a normal command. The
actual values of the parameters are then specified when SPI_execute_plan is called. This allows the prepared command to be used over a
wider range of situations than would be possible without parameters.
The statement returned by SPI_prepare can be used only in the current invocation of the procedure, since SPI_finish frees memory allocated
for such a statement. But the statement can be saved for longer using the functions SPI_keepplan or SPI_saveplan.
ARGUMENTS
const char * command
command string
int nargs
number of input parameters ($1, $2, etc.)
Oid * argtypes
pointer to an array containing the OIDs of the data types of the parameters
RETURN VALUE
SPI_prepare returns a non-null pointer to an SPIPlan, which is an opaque struct representing a prepared statement. On error, NULL will be
returned, and SPI_result will be set to one of the same error codes used by SPI_execute, except that it is set to SPI_ERROR_ARGUMENT if
command is NULL, or if nargs is less than 0, or if nargs is greater than 0 and argtypes is NULL.
NOTES
If no parameters are defined, a generic plan will be created at the first use of SPI_execute_plan, and used for all subsequent executions
as well. If there are parameters, the first few uses of SPI_execute_plan will generate custom plans that are specific to the supplied
parameter values. After enough uses of the same prepared statement, SPI_execute_plan will build a generic plan, and if that is not too much
more expensive than the custom plans, it will start using the generic plan instead of re-planning each time. If this default behavior is
unsuitable, you can alter it by passing the CURSOR_OPT_GENERIC_PLAN or CURSOR_OPT_CUSTOM_PLAN flag to SPI_prepare_cursor, to force use of
generic or custom plans respectively.
This function should only be called from a connected procedure.
SPIPlanPtr is declared as a pointer to an opaque struct type in spi.h. It is unwise to try to access its contents directly, as that makes
your code much more likely to break in future revisions of PostgreSQL.
The name SPIPlanPtr is somewhat historical, since the data structure no longer necessarily contains an execution plan.
PostgreSQL 9.2.7 2014-02-17 SPI_PREPARE(3)