Positional Parameter Settin in function

Paul Houtz gph at hpsemc.HP.COM
Tue Jun 6 09:33:11 AEST 1989


In my ksh, the "set" command doesn't seem to work within a function:

As a shell command  I do the following:

    $ set `date`
    $ echo $4
    16:31:00

Now if I declare a function:

    $ foo () {
     /    set `date`
     /    }
 
    $ foo
    $ echo $4
    16:31:00

As you can see, the old `date` is still in the positional parameters, otherwise
the seconds part of the date should have changed by now.  

Is this a bug in ksh?  Is it a feature?   Is there some explanation of this
feature?

Thanks for any help you can give.


Paul Houtz
HP Technology Access Center
10670 N. Tantau Avenue
Cupertino, Ca 95014
(408) 725-3864
hplabs!hpda!hpsemc!gph 
gph%hpsemc at hplabs.HP.COM
    



More information about the Comp.unix.wizards mailing list