Re: [BASH] shell functions don't work the same when opening sub-shells
From: Andrew Falanga (not_real_at_hp.com)
Date: 11/28/05
- Next message: Lew Pitcher: "Re: Env variable whit asterisk"
- Previous message: Chris F.A. Johnson: "Re: [BASH] shell functions don't work the same when opening sub-shells"
- In reply to: Andrew Falanga: "[BASH] shell functions don't work the same when opening sub-shells"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Nov 2005 09:00:12 -0700
Andrew Falanga wrote:
> Hi,
>
> I've got a rather odd occurrance when I open a sub-shell for changes to
> my environment. In my .bashrc file I have some shell functions that
> I've written to help make life easier for me.
>
> One of these functions takes an option, -p, and then a pattern to search
> for. The pattern if found, is used in creating the sub-shell. I have
> it setup that the function always defaults to a specific type of pattern
> if the -p option is not provided.
>
> When starting a new shell all works as it should, but after exiting a
> sub-shell and using this function again, the function completely ignores
> the -p option and simply uses the default. Can anyone shed some light
> as to why for me?
>
> ---------------------------------------------
> Andrew R. Falanga (a non-HP employee)
> Hewlett-Packard Company
> 11311 Chinden Blvd.
> Boise, Idaho
> ---------------------------------------------
> Please note: The e-mail address is purposely
> mangled. I do not wish my account at HP to
> become a spam haven.
Sorry for bugging people. I just managed to figure it out. I was
reading in the man page (imagine that!) that the OPTIND variable isn't
reset to 1 when getopts is called multiple times in the same shell
occurrance. I'm using getopts to find the options and since I'm calling
from the same occurrance of the shell, this was my problem.
Thanks for the help that would have been given and thanks for all the
help on my other issues I've asked about.
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
- Next message: Lew Pitcher: "Re: Env variable whit asterisk"
- Previous message: Chris F.A. Johnson: "Re: [BASH] shell functions don't work the same when opening sub-shells"
- In reply to: Andrew Falanga: "[BASH] shell functions don't work the same when opening sub-shells"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|