It is currently Fri, 15 Oct 2021 21:17:36 GMT

Author Message
 Posix function exports.
I am writing a POSIX compiant shell. The POSIX Manual I have at home,
states that functions exported by the export -f command, should be
put into the environment as "function()={ definition ;}".
But if I do a export -f in Bash a 'prinenv' gives
ls=() {
  /bin/ls -CF $*
You see , the '=' and the '()' are inversed. Can someone tell me what
the CORRECT implementation is. Or should I make a 'set' option of
both behavioures :-)
%    Miquel van Smoorenburg, Baljuwstraat 20, 2461 SL Langeraar, Holland    %
%         %
%              God is real, unless declared integer..                       %

 Mon, 28 Feb 1994 21:24:43 GMT   
 Posix function exports.
In article <> (Miquel van Smoorenburg) writes:

You're working from an old Posix.2 spec.  The current spec does not
allow functions to be exported.  The bash mechanism predates the
draft of Posix that specified exported functions, anyway.

I'd like to see the bash mechanism used, because it's the only working
example of exported functions that exists (the 9th and 10th edition sh
doesn't count; its method breaks every other implementation of getenv in
existance).  Lots of programs expect that the environment contains
variables that obey the sh variable syntax, and the old Posix syntax makes
that assumption invalid.

``Someday soon, I'm gonna tell the world about the crying game...''

Chet Ramey                        Internet: c...@po.CWRU.Edu
Case Western Reserve University   NeXT Mail: c...@macbeth.INS.CWRU.Edu

 Tue, 01 Mar 1994 04:42:07 GMT   
 Posix function exports.
[the bash implementation of exported functions is] the only working

Eh?  All functions in rc are exported.  rc doesn't even have a notion
of a function that is not exported.  The text of the function body is
stored in the environment in a way that doesn't break getenv(), though
in a different format than bash uses.  bash certainly doesn't have a
monopoly on functioning exported functions.
DaviD W. Sanderson (

 Tue, 01 Mar 1994 12:11:29 GMT   
 Posix function exports.
In article <> (DaviD W. Sanderson) writes:

You're right; I apologize for my parochialism.  I should have specified
a Bourne-style shell.

``Someday soon, I'm gonna tell the world about the crying game...''

Chet Ramey                        Internet: c...@po.CWRU.Edu
Case Western Reserve University   NeXT Mail: c...@macbeth.INS.CWRU.Edu

 Wed, 02 Mar 1994 01:55:04 GMT   
 Posix function exports.
Watching the discussion between c...@po.CWRU.Edu and
about Byron's rc vs bash reminds me to ask about this:

How hard would it be to modify bash so that it used the rc style history
mechanism, and remove readline at the same time ?  You see, I happen to
like bourne shell syntax especially the multiple rescanning :-) but
I hate the size of bash -- and the attendant startup delays.

What I'd like is to be able to delete the unnecessary gunk (like the
help command that really belongs in a separate program), especially
readline and history stuff, and get bash to write out the history file
in append mode after each interactive command is typed in -- so that
rc's history program can use it.

The two questions I'd want to ask are:

        How easy is it to do this?

        Is there general support for making this an official compile-time
Ronald Khoo <> +44 81 991 1142 (O) +44 71 229 7741 (H)

 Wed, 02 Mar 1994 17:13:54 GMT   
 Posix function exports.
In article <>, (Ronald S H Khoo) writes:

Well I reckon it should be easy.  I got bored one day and was _really sick_
of using csh for history.  So I hacked the System V.2.2 shell to do history
and wrote an `=' (or `:') from the spec in my Ninth Edition manual and from
what I could remember from my Eighth Edition days.

I cleaned up `type' [mild understatement] and turned it into `whatis' and
fixed bits of other braindamage.  It's not that hard.

I should point out that this was in my last job, where we were a System V vendor and we had the source.

When I got to ULTRIX I was faced with the same problem, but Byron's rc appeared
and it saved me a lot of pain and agony.

Byron has done _the job_.

Boyd Roberts          

``When the going gets wierd, the weird turn pro...''

 Tue, 08 Mar 1994 21:06:23 GMT   
   [ 6 post ] 

Similar Threads

1. exporting functions in ksh/sh-posix

2. POSIX newbie: POSIX function calls

3. posix message queues and other posix functions

4. Posix timer functions

5. a posix compliant function to read group database?

6. is lstat a POSIX function?

7. POSIX function for time with millisecs

8. POSIX question about error returns from system functions

9. POSIX scandir function

10. how 2 use timer_create/timer_settimer POSIX functions?

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software