exporting function in ksh / bash

exporting function in ksh / bash

Post by Tuyet Tram DANG NG » Sun, 24 Jan 1999 04:00:00



Hi,

Just a little question on functions in ksh/bash



Quote:> {
>   echo hello
> }


hello



ksh: titi: not found




Quote:> {
>   echo hello
> }


hello

titi=()
{
  echo hello  
Quote:}    




bash: titi: command not found

From these experiences I have some questions :
- where can I have the list of functions declared with ksh as it doesn't
  shows nor with 'set' nor with 'env', is there a way to make them appear as
  in bash ?
- why can't I export functions both in ksh and bash ? How could I do to do it ?
  don't functions declaration behave themselves not as variable ?

Thanks in advance

Tuyet Tram DANG NGOC
--

Laboratoire PRiSM -  Universite de Versailles-Saint-Quentin
http://www.prism.uvsq.fr/~dntt

 
 
 

exporting function in ksh / bash

Post by brian hile » Sat, 30 Jan 1999 04:00:00



> Just a little question on functions in ksh/bash


>> {
>>   echo hello
>> }

> hello



> ksh: titi: not found




>> {
>>   echo hello
>> }

> hello

> titi=()
> {
>   echo hello  
> }    



> bash: titi: command not found
> From these experiences I have some questions :
> - where can I have the list of functions declared with ksh as it doesn't
>   shows nor with 'set' nor with 'env', is there a way to make them appear as
>   in bash?

In ksh:
typeset +f
functions
The latter is actually a predefined alias to the former.

Quote:> - why can't I export functions both in ksh and bash? How could I do to do it?
>   don't functions declaration behave themselves not as variable?

Exported functions are exported to shell environments _not created with
a separate invocation of the shell_ (quote from memory from "The Kornshell
Command and Programming Language.")

Ksh93 has eliminated the capability of exporting functions; such things
are now expected to be defined in a per-process $ENV file.

I am unaware of the position bash takes in this. RTFM.

Quote:> Thanks in advance; Tuyet Tram DANG NGOC
> http://www.prism.uvsq.fr/~dntt

-Brian

 
 
 

exporting function in ksh / bash

Post by Jon LaBad » Sat, 30 Jan 1999 04:00:00





   ...
~> > From these experiences I have some questions :
~> > - where can I have the list of functions declared with ksh as it doesn't
~> >   shows nor with 'set' nor with 'env', is there a way to make them appear as
~> >   in bash?
~>
~> In ksh:
~> typeset +f
~> functions
~> The latter is actually a predefined alias to the former.
~>
~> > - why can't I export functions both in ksh and bash? How could I do to do it?
~> >   don't functions declaration behave themselves not as variable?
~>
~> Exported functions are exported to shell environments _not created with
~> a separate invocation of the shell_ (quote from memory from "The Kornshell
~> Command and Programming Language.")
~>
~> Ksh93 has eliminated the capability of exporting functions; such things
~> are now expected to be defined in a per-process $ENV file.

Or installed in a directory referenced by the FPATH variable?

jl
--


 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)

 
 
 

1. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

Is there a proper fixed bash on any of the FTP sites out there?

I know there bash is on the usual sites but I don't know if they are
bugged or not :(

Regards,

Neil.

--


------------------------------------| Edinburgh, EH14 2DE, United Kingdom
**Domino: There`s nothing you can do when you`re the next in line: Domino**

2. SOS xfree86 is not working SOS please HELPPP

3. Exporting functions in ksh?

4. Korn Shell query...is there any source or compiled versions?

5. Exporting vars in -ksh function (the solution!)

6. Hardwares Recommendation.

7. troubles with export of a function (using bash 2.05.8)

8. Kernel 2.3.9

9. Exporting vars from -ksh functions

10. exporting functions in ksh/sh-posix

11. exporting function in KSH

12. Exporting and Invoking Functions in ksh

13. Calling functions written in BASH from KSH?