shell functions

shell functions

Post by DA » Fri, 12 Aug 1994 09:27:56

When using functions in sh or ksh I've had to place the them at
the beginning of the script, so that the routine would be found.
Question: The man pages say that set -h will allow functions to
be located when required.. why doesn't this work? I'm running
solaris 2.3 with bourne scripts..



1. shell functions don't work the same when opening sub-shells


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.

2. ODS and Solaris 2.6

3. finding/execing a shell with shell functions?


5. Invoking shell function, shell script or alias with only partial match?

6. clean shutdowns still

7. shell function question

8. W95 + NT4 + RedHat5.0 on 1 harddisk

9. Help need with a Shell Function

10. HELP: Shell function lives once

11. Shell function and typeset in ksh

12. Addendum:How to write a shell function

13. passing parameters with spaces to shell function