bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does this work


From: Chris F.A. Johnson
Subject: Re: Why does this work
Date: Wed, 30 Jan 2002 14:09:18 GMT

On Wed, 30 Jan 2002, Stephan Austermühle wrote:

> Hi!
>
> On Wed, Jan 30, 2002 at 08:24:35AM -0500, Chet Ramey wrote:
>
> > > - Why does this work with bash but not with ksh?
> > Which part?
>
> Why remains $0 the same in a function with bash but not with ksh?

It will remain the same in ksh if you define the function with:

        myfunction() {
            echo "$0 = $0"
        }

instead of:

        function myfunction {
            echo "$0 = $0"
        }

> It's not easy the write scripts that run with any shell...

It's not just which shell, but which version of which shell, and on
which operating system. :(

It also depends on external commands; different operating systems use
different sets of utilities. Not all have the same behaviour or the
same set of options.


The closest there is to a standard is the POSIX/Single Unix
Specification available at:
        http://www.unix-systems.org/version3/online.html

Not all systems conform to it, but many are getting close.

-- 
        Chris F.A. Johnson                              bq933@torfree.net
        =================================================================
        c.f.a.johnson@rogers.com                http://cfaj.freeshell.org
        cfaj@freeshell.org        http://members.rogers.com/c.f.a.johnson



reply via email to

[Prev in Thread] Current Thread [Next in Thread]