Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Korn Positional Parameters

Status
Not open for further replies.

dbbyleo

IS-IT--Management
Sep 10, 2002
20
0
0
US
Can positional parameters in korn be resetted?
What I mean is, if I have a script that takes 3 srguments:

$ myscript arg1 arg2 arg3
...script runs and so $1 is equal to arg1; and $2 is equal to arg2, etc...

When I ran it again WITHOUT provide any arguments:

$ myscript
...

It runs with the previous arguments in effect.

Is there a way to keep that from happening in Korn?

I know in bash, that does not happen.
 
Don't know what you are doing, but that does not happen!


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
oh I get it. I was acutally doing this:

$ . ./myscript arg1 arg2

and then (without the args):

$ . /myscript

And both would have the same outputs.

But if I do this:

$ ./myscript arg1 arg2
$ ./myscript

then the arguments do not persist.

Forgive me, I'm a newbie. What is the differences between these 2 ways of executing the script?

And are the technical terms between these "sourcing" vs. "executing":

Sourcing (when you do $ . ./myscript)

VS.

Executing (when you $ ./myscript ...I do know that to do this, I have to change the files execution permission.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top