---------- Post updated at 04:49 AM ---------- Previous update was at 04:30 AM ----------
Quote:
Originally Posted by Skrynesaver
Code:
man getopts
Running the following
Code:
#! /bin/bash
while getopts "abc:n" opt; do
case $opt in
a ) a="true";;
b ) b="true";;
c ) c=$OPTARG;;
n ) n="true";;
esac
done
shift $(($OPTIND - 1)) # remove all options from the argument array
echo "a is $a
b is $b
c is $c
n is $n
remaining args are $*";
returns
Code:
~$ ./test.sh -abc setting -n filename otherfile directory
a is true
b is true
c is setting
n is true
remaining args are filename otherfile directory
How many arguments are allowed in this? I tried using it but kept getting an error on the last argument.
Code:
email() {
while getopts "t:c:b:s:f" opt
do
case $opt in
t ) To=$OPTARG;;
c ) Cc=$OPTARG;;
b ) Bcc=$OPTARG;;
s ) Subject=$OPTARG;;
f ) File=$OPTARG;;
esac
done
shift $(($OPTIND - 1)) # remove all options from the argument array
echo "t is $To
c is $Cc
b is $Bcc
s is $Subject
f is $File
remaining args are $*";
(
echo "From: NoReply@Adshocker.com"
echo "To: $To"
echo "Cc: $Cc"
echo "Bcc: $Bcc"
echo "Subject: $Subject"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="-1234567890"'
echo
echo '---1234567890'
echo "Content-Type: text/plain"
echo "Content-Disposition: inline"
echo
echo
echo
echo
if [ -n $File ]
then
echo
echo '---1234567890'
echo 'Content-Type: application; name="'${File##*/}'"'
echo "Content-Transfer-Encoding: uuencode"
echo 'Content-Disposition: attachment; filename="'${File##*/}'"'
echo
uuencode $File $File
echo
echo '---1234567890--'
fi
) | sendmail -t
}
The error I get is "ksh: test: 0403-004 Specify a parameter with this command.".
Hey guys,
I have this problem : I can run on an sqlprompt
!ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous
which will ftp the file from Unix to an NT machine, but if I do
exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING.
I have no... (4 Replies)
I have a db2 stored procedure on my database which require 3 parameters, I have the following db2 command in a sql script
CONNECT TO SAMPLE;
CALL BACKUP(INPUT_1, INPUT_2, INPUT3);
Usually, I would just invoke this sql script from my shell script like below
db2 -tf... (1 Reply)
Hi,
I have screen which was desined in PL/SQL Catridges in apps. In that screen some enterable fields these values r the passing parameters to create value sets, functions, menus etc in apps by using front end screens. Now in that screen i have a button. when i click that button it have to... (0 Replies)
Hi All,
My script will call a storedprocedure
#!/bin/bash
#
# Script for ...........
. ../conf/setting.env # Environment file to set the DATABASE
#TODAY=`date '+%Y%m%d_%H'`
#echo TODAY = $TODAY
sqlplus -s $DATABASE <<EOF
spool $TRACKING_LOGDIR/CalcFreqPgsVues_H.log
exec... (3 Replies)
foll. is my code snippet.
#!/bin/ksh
retVal=`sqlplus -s user/passwd@oracle_sid <<EOF
SET SERVEROUTPUT ON SIZE 100000
DECLARE
STATUS_VALUE CHAR;
BEGIN
SELECT temp1 INTO STATUS_VALUE FROM sai;
DBMS_OUTPUT.PUT_LINE(STATUS_VALUE);
END;
/
SET... (1 Reply)
Hello,
I created a sql file to create a Procedure, and it was successfully created.
I created a sql file to execute the procedure, and it did without any errors, but i dont see the data been updated.
The Execute procedure.sql script is:
BEGIN
set serveroutput on size 1000000
execute... (5 Replies)
I am invoking a SQL script from shell script. This SQL script will invoke a stored procedure(which has the OUT parameter). I want to have the OUT parameter in the shell script as a variable. Is this possible? (6 Replies)
Hi,
I want to have a automted script to exceute 20 procedures one by one.
Suppose below is one procedure once it get executed script will write
"PL/SQL procedure successfully completed." to a log
for ex-
exec dbms_stats.gather_table_stats();
Now later procedure starts executing... (1 Reply)
Hi,
I have a doubt regarding how sub scripts will be executed and interested to know internal workflow,
For example - My main script is A,it calls a script B then B will call some C....and so on. Then B script run parallel to A or it will wait B to execute then
A will continue.
... (1 Reply)
i have the following code inside a shell script .prog in oracle server when i call the program
DBMS_OUTPUT.PUT_LINE(x_return_status|| ln_rep_req_id);
will return 0 , it is very strange , i try to submit the concurrent request in oracle , and it can successfully executed, what am i missing ? i... (1 Reply)