The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
call function in one script from another script minifish Shell Programming and Scripting 6 10-23-2008 10:04 AM
Problem with function script. gzs553 Shell Programming and Scripting 3 04-21-2008 04:15 PM
Pearl script to automate SSL certificate import m_kk UNIX for Advanced & Expert Users 4 02-12-2008 04:24 PM
Function Bug in script - need help gzs553 Shell Programming and Scripting 4 06-05-2007 02:35 AM
getting the value of a c function in shell script surjyap Shell Programming and Scripting 1 09-27-2005 05:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-02-2008
wolfhurt wolfhurt is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 8
import var and function from ksh script to another ksh script

Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions

i would have a only single script file to declare my variables, like:

Code:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }
function cd { ...}
...

and import this from all my others scripts
? is there any way to do except using export command ?

[sourcing a sh script . myscript or ./myscript work but not in ksh]


thx

Last edited by wolfhurt; 04-02-2008 at 09:38 AM..
  #2 (permalink)  
Old 04-02-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Sourcing some code to establish variables and functions should work fine in ksh. I do it all the time.
. /path/to/included file
. is the name of the command. It must be followed by a space. Then comes the file to be sourced.
  #3 (permalink)  
Old 04-02-2008
wolfhurt wolfhurt is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 8
. thescript dont work in ksh, my script is on the same directory

but . ./thescript work for sourcing in same directory

thank you
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0