Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

How to source a file in KSH -- Please help !!!

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-02-2006
tipsy tipsy is offline
Registered User
 
Join Date: Jun 2006
Last Activity: 11 September 2008, 3:39 PM EDT
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL How to source a file in KSH -- Please help !!!

Hi,
Can anyone tell me how to source a file inside a KSH script.
I can do it in CSH using the "source" command.
source /home/tipsy/sourceme.prf

What is the equivalent command in KSH? I tried "exec" but after executing the statement no furthers statements are executed.

Please let me know.

Regards,
Tipsy.
Sponsored Links
    #2  
Old Unix and Linux 08-02-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
 
Join Date: Jan 2005
Last Activity: 27 September 2011, 12:36 PM EDT
Posts: 683
Thanks: 0
Thanked 4 Times in 4 Posts
. /home/tipsy/sourceme.prf
Sponsored Links
    #3  
Old Unix and Linux 08-02-2006
tipsy tipsy is offline
Registered User
 
Join Date: Jun 2006
Last Activity: 11 September 2008, 3:39 PM EDT
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks that worked.

I was trying . ./home/tipsy/sourceme.prf and breaking my head.

Regards,
Tipsy.
    #4  
Old Unix and Linux 08-02-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
 
Join Date: Jan 2005
Last Activity: 27 September 2011, 12:36 PM EDT
Posts: 683
Thanks: 0
Thanked 4 Times in 4 Posts
That would work if your current working directory is "above" where "home" is. So if "home" is somewhere like /u01/home, then, if your current working directory is /u01, then your attempt would work. Since you said that my suggestion worked, your "home" is mounted from "/" and will allways fail.
Sponsored Links
    #5  
Old Unix and Linux 01-14-2008
bnix bnix is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 14 January 2008, 10:07 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
how to source a csh file from ksh

I have some common parameters established by setenv in a csh file.
I can "source" this file ( " source /path/aaa.csh " ) from inside a csh file and then access those parameters from the calling script.

I wish to source the same csh file from inside a ksh script; but the ksh script processor refuses to recognize the #!/bin/csh statement in the csh file; and therefore refuses to process a setenv; it expects an export statement.
(I used " . /path/aaa.csh " in the ksh script)

I don't want to create a ksh version of this parameter file. Is there a way to source a csh file from a ksh calling routine?

Thank for any insight and guidance you can provide.
Sponsored Links
    #6  
Old Unix and Linux 04-14-2008
rharris rharris is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 29 January 2009, 1:39 PM EST
Location: Dallas, Texas
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I have this exact, same question. Did you ever get an answer to come up with an alternate solution?
Sponsored Links
    #7  
Old Unix and Linux 04-14-2008
rharris rharris is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 29 January 2009, 1:39 PM EST
Location: Dallas, Texas
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Did you ever get an answer OR come up with an alternate solution?
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Match the amount fields in the source file vs trigger file vijaylak UNIX for Dummies Questions & Answers 4 12-28-2011 02:43 PM
Split File by Pattern with File Names in Source File... Awk? cul8er Shell Programming and Scripting 2 11-25-2011 01:38 PM
how to copy downloaded file into my source file folder (putty/unix) fakuse Programming 2 11-16-2011 05:44 PM
Post Shell programming: Question about source a file and read data from the file ccwq Shell Programming and Scripting 3 08-04-2007 10:28 PM



All times are GMT -4. The time now is 03:18 AM.