This is how I would approach the problem shown in post #1, making use of bash features like "parameter expansion / Remove matching suffix pattern" and testing empty "conditional expressions". It could seriously benefit from some polishing, e.g. combining grep runs, variable quoting, error handling, and upfront argument compliance checks. Try
I am new to shell, and I am trying to do a if statement like the following:
if ; then
basically it works fine if both arguments of the if are met, however the next elif is:
elif ; then
if the conditions of the elif are met, then it says "final1.sh: line 67: [: too many arguments"
... (6 Replies)
In my ksh script, if the conditions of a if statement are true, then do nothing; otherwise, execute some commands.
How do I write the "do nothing" statement in the following example?
Example:
if (( "$x"="1" && "$y"="a" && "$z"="happy" ))
then
do nothing
else
command
command
fi... (3 Replies)
Hi All,
I am using Unix ksh script.
I need to insert values to a table using the o/p from a slelect statement.
Can anybody Help!
My script looks like tihs.
---`sqlplus -s username/password@SID << EOF
set heading off
set feedback off
set pages 0
insert into ${TB_NAME}_D... (2 Replies)
I can't find anything wrong with this line of code, it works when there is one file in the directory but more than one i get a "too many arguements2 error
if ; then
am i missing something? (3 Replies)
Hello friends,
I have a boubt passing different arguments at a time for any one option in below code.
I would also like to check which option has been selected (any one of i, r, u ) so that whether or not matching argument passed can be verified.
for i and r - install and re-install -... (4 Replies)
I am writing a script in bash and want to perform the operation
I check number of arguments and make a print statement with the passes arguments
If I pass 3 arguments I will do
printf "$frmt" "$1" "$2" "$3"If I have 4 arguments I do
printf "$frmt" "$1" "$2" "$3" "$4"etc (4 Replies)
Hi
Am pretty new to C..
Am trying to pass the arguments from command line and use them in switch case statement..
i have tried the following
#include <stdlib.h>
main(int argc, char* argv)
{
int num=0;
if ( argc == 2 )
num = argv;
printf("%d is the num value",num);
switch ( num )
... (2 Replies)
Hello,
I have a question regarding the usage statement of a script.
I have 2 parameters "--pto" and "--pto_list". To start the script I will need one of them. Both together are not possible.
How this would be printed out within a usage statement?
My suggestion would be:
Usage:... (4 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
LEARN ABOUT CENTOS
spi_execute_plan
SPI_EXECUTE_PLAN(3) PostgreSQL 9.2.7 Documentation SPI_EXECUTE_PLAN(3)NAME
SPI_execute_plan - execute a statement prepared by SPI_prepare
SYNOPSIS
int SPI_execute_plan(SPIPlanPtr plan, Datum * values, const char * nulls,
bool read_only, long count)
DESCRIPTION
SPI_execute_plan executes a statement prepared by SPI_prepare or one of its siblings. read_only and count have the same interpretation as
in SPI_execute.
ARGUMENTS
SPIPlanPtr plan
prepared statement (returned by SPI_prepare)
Datum * values
An array of actual parameter values. Must have same length as the statement's number of arguments.
const char * nulls
An array describing which parameters are null. Must have same length as the statement's number of arguments. n indicates a null value
(entry in values will be ignored); a space indicates a nonnull value (entry in values is valid).
If nulls is NULL then SPI_execute_plan assumes that no parameters are null.
bool read_only
true for read-only execution
long count
maximum number of rows to return, or 0 for no limit
RETURN VALUE
The return value is the same as for SPI_execute, with the following additional possible error (negative) results:
SPI_ERROR_ARGUMENT
if plan is NULL or invalid, or count is less than 0
SPI_ERROR_PARAM
if values is NULL and plan was prepared with some parameters
SPI_processed and SPI_tuptable are set as in SPI_execute if successful.
PostgreSQL 9.2.7 2014-02-17 SPI_EXECUTE_PLAN(3)