Re: Korn Shell Q

2002-03-06 Thread Stephane Faroult

"Post, Ethan" wrote:
> 
> AH HA!
> 
> just remembered it, eval
> 
> Let's see if this works!
> 

Ethan,

   It's a bit of fudging, but what you could also do is use another
separator than a space (eg : as in dba:apps) and then use cut or awk to
slice the argument.
-- 
Regards,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread James Morle

eval foo.sh $FOO
Should do the trick...

--
James Morle
Scale Abilities, Ltd
http://www.scaleabilities.co.uk
Author of "Scaling Oracle8i - Building Highly Scalable OLTP System
Architectures"

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of 
> Post, Ethan
> Sent: 06 March 2002 19:23
> To: Multiple recipients of list ORACLE-L
> Subject: RE: Korn Shell Q
> 
> 
> No that did not work, thanks.  I remember the command I am 
> more specifically looking for, it is a command that says to 
> do expansion twice on a line, anyone remember what this is?
> 
> basically if you have a variable that looks as follows
> 
> echo $FOO
> 
> -g "dba apps"
> 
> the double quotes will get exanded another time so they are 
> picked up correctly when you call
> 
> foo.sh $FOO
> 
> - Ethan
> 
> 
> 
> -Original Message-
> Sent: Wednesday, March 06, 2002 12:32 PM
> To: Multiple recipients of list ORACLE-L
> 
> 
> Ethan, I had a similar problem when using the getopts
> command when using it in conjuction with nohup and the
> &. I found by throwing ksh in the syntax everthing
> worked. i.e. nohup ksh setup.ksh -a parameters & 
> 
> This may or may not work for you but it's worth a try.
> 
> Scott
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Post, Ethan
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') 
> and in the message BODY, include a line containing: UNSUB 
> ORACLE-L (or the name of mailing list you want to be removed 
> from).  You may also send the HELP command for other 
> information (like subscribing).
> 


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: James Morle
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Post, Ethan

Thanks to all that tried to help, that fixed it.

Surrounded the call from script A to script B with eval and it expands the
line the way I needed it.

eval "exfail.sh $EXFAIL_OPTIONS $SID"

Thanks,
Ethan

-Original Message-
Sent: Wednesday, March 06, 2002 1:23 PM
To: Multiple recipients of list ORACLE-L


No that did not work, thanks.  I remember the command I am more specifically
looking for, it is a command that says to do expansion twice on a line,
anyone remember what this is?

basically if you have a variable that looks as follows

echo $FOO

-g "dba apps"

the double quotes will get exanded another time so they are picked up
correctly when you call

foo.sh $FOO

- Ethan


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Post, Ethan

AH HA!


just remembered it, eval

Let's see if this works!

-Original Message-
Sent: Wednesday, March 06, 2002 1:23 PM
To: Multiple recipients of list ORACLE-L


No that did not work, thanks.  I remember the command I am more specifically
looking for, it is a command that says to do expansion twice on a line,
anyone remember what this is?

basically if you have a variable that looks as follows

echo $FOO

-g "dba apps"

the double quotes will get exanded another time so they are picked up
correctly when you call

foo.sh $FOO

- Ethan

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Post, Ethan

No that did not work, thanks.  I remember the command I am more specifically
looking for, it is a command that says to do expansion twice on a line,
anyone remember what this is?

basically if you have a variable that looks as follows

echo $FOO

-g "dba apps"

the double quotes will get exanded another time so they are picked up
correctly when you call

foo.sh $FOO

- Ethan



-Original Message-
Sent: Wednesday, March 06, 2002 12:32 PM
To: Multiple recipients of list ORACLE-L


Ethan, I had a similar problem when using the getopts
command when using it in conjuction with nohup and the
&. I found by throwing ksh in the syntax everthing
worked. i.e. nohup ksh setup.ksh -a parameters & 

This may or may not work for you but it's worth a try.

Scott

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Scott

Ethan, I had a similar problem when using the getopts
command when using it in conjuction with nohup and the
&. I found by throwing ksh in the syntax everthing
worked. i.e. nohup ksh setup.ksh -a parameters & 

This may or may not work for you but it's worth a try.

Scott

--- "Post, Ethan" <[EMAIL PROTECTED]> wrote:
> The problem is I am using "getopt" to process the
> switches...
> 
> while getopts :pg: option
> do
>case $option in
>   p) OPTION_p=Y ;;
>   g) GID=$OPTARG  ;;
>  \?) print $OPTARG is not a valid argument. ;
> exit 0 ;;
>esac
> done
> 
> shift $(expr $OPTIND - 1)
> 
> After the shift, the $1 arg should be the ORACLE_SID
> passed in. 
> 
> When called directly everything works fine...
> 
> exfail.sh -p -g "dba apps" TEST
> 
> echo $GID returns
> 
> dba apps
> 
> When called from another script echo $GID returns
> 
> "dba
> 
> You can see it thinks the double quote is part of
> the argument for -g, is
> also does not thing apps is part of it.  The reason
> is how it is treating
> the " double quotes.  When called directly it sees
> them as surrounding the
> dba and apps words and all of it is part of the -g
> argment.  When called
> from a script dynaically it treats the double quotes
> as part of the argment.
> I think I will paly around with single ticks to see
> if that works.  I think
> there is a command that will basically expand the
> command once before
> running it, and I think that will work, but I can't
> recall it at the moment.
> I will keep tinkering.
> 
> Thanks,
> Ethan
> 
> -Original Message-
> Sent: Wednesday, March 06, 2002 11:15 AM
> To: Multiple recipients of list ORACLE-L
> 
> 
> Ethan --
> 
> As I understand it, your skip isn't working if there
> are multiple parameters
> passed in, so that when you get your parameters and
> do your skip, you are
> skipping one "word" and then the next parameter
> fails.  If that is the case,
> what you may want to do is parse out the
> multi-parameter string with awk -F"
> {'print $2'}.  Then count the words separately and
> skip those.
> 
> HTH.  BTW, I'm tied up with AppsDBA stuff and am not
> monitoring the List as
> I should.  Feel free to email me directly if I can
> provide addition
> assistance.
> 
> Bambi.
> -- 
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.com
> -- 
> Author: Post, Ethan
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX:
> (858) 538-5051
> San Diego, California-- Public Internet
> access / Mailing Lists
>

> To REMOVE yourself from this mailing list, send an
> E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of
> 'ListGuru') and in
> the message BODY, include a line containing: UNSUB
> ORACLE-L
> (or the name of mailing list you want to be removed
> from).  You may
> also send the HELP command for other information
> (like subscribing).


__
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Scott
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Post, Ethan

The problem is I am using "getopt" to process the switches...

while getopts :pg: option
do
   case $option in
  p) OPTION_p=Y ;;
  g) GID=$OPTARG  ;;
 \?) print $OPTARG is not a valid argument. ; exit 0 ;;
   esac
done

shift $(expr $OPTIND - 1)

After the shift, the $1 arg should be the ORACLE_SID passed in. 

When called directly everything works fine...

exfail.sh -p -g "dba apps" TEST

echo $GID returns

dba apps

When called from another script echo $GID returns

"dba

You can see it thinks the double quote is part of the argument for -g, is
also does not thing apps is part of it.  The reason is how it is treating
the " double quotes.  When called directly it sees them as surrounding the
dba and apps words and all of it is part of the -g argment.  When called
from a script dynaically it treats the double quotes as part of the argment.
I think I will paly around with single ticks to see if that works.  I think
there is a command that will basically expand the command once before
running it, and I think that will work, but I can't recall it at the moment.
I will keep tinkering.

Thanks,
Ethan

-Original Message-
Sent: Wednesday, March 06, 2002 11:15 AM
To: Multiple recipients of list ORACLE-L


Ethan --

As I understand it, your skip isn't working if there are multiple parameters
passed in, so that when you get your parameters and do your skip, you are
skipping one "word" and then the next parameter fails.  If that is the case,
what you may want to do is parse out the multi-parameter string with awk -F"
{'print $2'}.  Then count the words separately and skip those.

HTH.  BTW, I'm tied up with AppsDBA stuff and am not monitoring the List as
I should.  Feel free to email me directly if I can provide addition
assistance.

Bambi.
-- 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Bellows, Bambi

Ethan --

As I understand it, your skip isn't working if there are multiple parameters
passed in, so that when you get your parameters and do your skip, you are
skipping one "word" and then the next parameter fails.  If that is the case,
what you may want to do is parse out the multi-parameter string with awk -F"
{'print $2'}.  Then count the words separately and skip those.

HTH.  BTW, I'm tied up with AppsDBA stuff and am not monitoring the List as
I should.  Feel free to email me directly if I can provide addition
assistance.

Bambi.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Bellows, Bambi
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-06 Thread Alex

post your script.

On Tue, 5 Mar 2002, Post, Ethan wrote:

> Forgot something the call from inside the check_all_exfail.sh script looks
> like this...
> 
> exfail.sh $EXFAIL_OPTIONS $ORACLE_SID
> 
> -Original Message-
> Sent: Tuesday, March 05, 2002 10:23 PM
> To: Multiple recipients of list ORACLE-L
> 
> 
> I have a shell script called exfail.sh which checks for potential extent
> failures on a database.  The script accepts a couple of command line
> switches.
> 
> exfail.sh -p -g "dba apps" TEST
> 
> Basically this says run the exfail.sh script against the "TEST" instance,
> (-p) page people if there are problems, (-g) send the page/email to everyone
> in the "dba" and "apps" group.
> 
> This works just fine.  I have another script which rolls through the oratab
> file and calls exfail.sh against every database on the host.
> 
> check_all_exfail.sh
> 
> The scripts sources in some environment files which set up the command line
> parameters for the host or database.
> 
> EXFAIL_OPTIONS="-p -g \"dba apps\""
> 
> When I run "set -x" in the script I can see the call from
> check_all_exfail.sh to exfail.sh is correct just like the first example.
> 
> exfail.sh -p -g "dba apps" TEST
> exfail.sh -p -g "dba apps" DEV
> exfail.sh -p -g "dba apps" FOO
> ...
> 
> However the exfail.sh script parses the command line in an entirely
> different manner.  The -g switch picks up 
> 
> "dba
> 
> as the $OPTARG and not 
> 
> dba apps
> 
> thus 
> 
> apps"
> 
> becomes the $1 argument instead of the correct
> 
> TEST
> 
> I know I need to tell the check_all_exfail.sh file to parse the line twice
> (I think) bit I can't remember the command off had to do this.  Anyone have
> some ideas for me to try?
> 
> Thanks,
> Ethan
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Post, Ethan
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Post, Ethan
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California-- Public Internet access / Mailing Lists
> 
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).
> 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Alex
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Korn Shell Q

2002-03-05 Thread Post, Ethan

Forgot something the call from inside the check_all_exfail.sh script looks
like this...

exfail.sh $EXFAIL_OPTIONS $ORACLE_SID

-Original Message-
Sent: Tuesday, March 05, 2002 10:23 PM
To: Multiple recipients of list ORACLE-L


I have a shell script called exfail.sh which checks for potential extent
failures on a database.  The script accepts a couple of command line
switches.

exfail.sh -p -g "dba apps" TEST

Basically this says run the exfail.sh script against the "TEST" instance,
(-p) page people if there are problems, (-g) send the page/email to everyone
in the "dba" and "apps" group.

This works just fine.  I have another script which rolls through the oratab
file and calls exfail.sh against every database on the host.

check_all_exfail.sh

The scripts sources in some environment files which set up the command line
parameters for the host or database.

EXFAIL_OPTIONS="-p -g \"dba apps\""

When I run "set -x" in the script I can see the call from
check_all_exfail.sh to exfail.sh is correct just like the first example.

exfail.sh -p -g "dba apps" TEST
exfail.sh -p -g "dba apps" DEV
exfail.sh -p -g "dba apps" FOO
...

However the exfail.sh script parses the command line in an entirely
different manner.  The -g switch picks up 

"dba

as the $OPTARG and not 

dba apps

thus 

apps"

becomes the $1 argument instead of the correct

TEST

I know I need to tell the check_all_exfail.sh file to parse the line twice
(I think) bit I can't remember the command off had to do this.  Anyone have
some ideas for me to try?

Thanks,
Ethan
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Post, Ethan
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).