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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I "include" text in a script ?

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
I have a batch Korn script that runs nightly via cron.
When it runs, I want it to "include" or read in text from another script.
 
You can execute commands in another script simply calling it... if you want to "define" functions or aliases in the child script then you must to execute the commands in the same environment... how you do that? If you are in the Bourne Shell, the Korn Shell or Bourne Again Shell (sh,ksh,bsh) you must to use
[tt]
. /name/of/script
[/tt]

If you are in the C Shell or derivatives like TCSh you must to use
[tt]
source /name/of/script
[/tt]

I hope it works...
 
If you call...
<path>/myscript.sh < /tmp/myinput
then this will read input...
alternatively if they both run at once you could create a pipe from one to the other...
<path>/myfirstscript | <path>/myusingscript.sh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top