[comp.unix.wizards] source command on ksh?

Leisner.Henr@xerox.com (Marty) (11/01/88)

A friend of mine is using the MKS korn shell on DOS and wanted to know:

"How do I run a shell script in the context of the current shell?"

On csh, the source command does exactly what we want to do.

How do I do it on ksh?


marty
ARPA:	leisner.henr@xerox.com
GV:  leisner.henr
NS:  martin leisner:wbst139:xerox
UUCP:	nsc!nscimg!amps!marty
 

khb%chiba@Sun.COM (Keith Bierman - Sun Tactical Engineering) (11/01/88)

In article <17396@adm.BRL.MIL> Leisner.Henr@xerox.com (Marty) writes:
>A friend of mine is using the MKS korn shell on DOS and wanted to know:
>
>"How do I run a shell script in the context of the current shell?"
>
>On csh, the source command does exactly what we want to do.
>
>How do I do it on ksh?

. filename

Of course one can alias source so that it is .


Keith H. Bierman
It's Not My Fault ---- I Voted for Bill & Opus

lvc@cbnews.ATT.COM (Lawrence V. Cipriani) (11/01/88)

In article <17396@adm.BRL.MIL> Leisner.Henr@xerox.com (Marty) writes:
>A friend of mine is using the MKS korn shell on DOS and wanted to know:
>"How do I run a shell script in the context of the current shell?"
>How do I do it on ksh?

Use the `dot' command:

	. filen [arg ...]

Where filen is the name of the file to be sourced and [arg ...] are
optional arguments.
-- 
Larry Cipriani, AT&T Network Systems, Columbus OH,
Path: att!cbnews!lvc    Domain: lvc@cbnews.ATT.COM

exodus@mfgfoc.uucp (Greg Onufer) (11/02/88)

From article <17396@adm.BRL.MIL>, by Leisner.Henr@xerox.com (Marty):
> A friend of mine is using the MKS korn shell on DOS and wanted to know:
> "How do I run a shell script in the context of the current shell?"
> On csh, the source command does exactly what we want to do.
> How do I do it on ksh?

This question really does NOT belong in this newsgroup....
try comp.unix.questions, but the answer follows anyways:

	.

Yes, a period.  Try a period followed by a space and then the filename
of the file you wish to "source".  I prefer source myself, a period
is not very self-documenting.

-greg
-- 
Greg Onufer   //  Focus Semiconductor  //     University of the Pacific
  exodus@cheers.uucp (daver!cheers!exodus@Sun.COM) 	415-965-0604

collin@hpindda.HP.COM (Collin Park) (11/02/88)

Will 

	$ . scriptfile

do it for you?  it seems to work OK for me (on ksh on hp9000/800; haven't
tried it on MKS ksh on PC)

------------------------------------------------------------------------------
Unless explicitly stated otherwise, opinions expressed above are my
own and do not explicitly reflect those of the Hewlett-Packard Company
or any other person or entity.

collin park			Hewlett-Packard Company
+1-408-447-3822			19420 Homestead Road -- MS 43LT
collin%hpinddu@sde.hp.com	Cupertino, CA  95014  USA		      

guy@auspex.UUCP (Guy Harris) (11/02/88)

>"How do I run a shell script in the context of the current shell?"
>
>On csh, the source command does exactly what we want to do.
>
>How do I do it on ksh?

The same way you do it with the Bourne shell; the "." command.

daveh@marob.MASA.COM (Dave Hammond) (11/04/88)

In article <17396@adm.BRL.MIL> Leisner.Henr@xerox.com (Marty) writes:
>A friend of mine is using the MKS korn shell on DOS and wanted to know:
>
>"How do I run a shell script in the context of the current shell?"

In both ksh and sh, the dot (".") command does this, e.g.:

. shell_script

Dave Hammond
  UUCP: ...!uunet!masa.com!{marob,dsix2}!daveh
DOMAIN: daveh@marob.masa.com
----------------------------------------------------------------------------