The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Background execution of a script Cameron Shell Programming and Scripting 2 10-03-2007 02:50 AM
error during the execution of script surjyap Shell Programming and Scripting 1 08-24-2007 05:10 PM
pb with script execution Cecile UNIX for Dummies Questions & Answers 3 09-14-2006 07:37 AM
Script execution information manthasirisha Shell Programming and Scripting 12 07-07-2006 05:54 AM
execution of shell script malaymaru Shell Programming and Scripting 5 06-13-2005 06:49 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-12-2006
Registered User
 

Join Date: Aug 2006
Location: Lyon France
Posts: 12
Pb with script execution and variables

Hello,

Can somebody tell me the differnce between a call of a ksh with the dot :

>. script.ksh

and the call without the dot:

>script.ksh

In my script I have writen a test for the number of parameters:
if [ $# -ne 0 ]
then echo 'Usage : '$0
exit 1
fi

as my script doesn't need any parameter

if I call like this:
>. script.ksh
$# =
$0 = -ksh
which is wrong
I can't do a correct test of my parameters, but if I remove the parameter test I can give value to variables, and these variables are known and have a value in my parent shell and can be used by other scripts

If I call like this:
>script.ksh
$# = 0
$0 = script.ksh
which is OK, but I want to export variables that must be used in other script and my variables remains unknown in my parent shell
but it seems that I can execute other script that can see the variables....

I don't understand anything....

see you
Cécile
Reply With Quote
Forum Sponsor
  #2  
Old 09-15-2006
Registered User
 

Join Date: Sep 2006
Posts: 4
The difference is

$> . script.ksh

script.ksh is run in the current shell environment.

$> script.ksh

script.ksh is run in a new shell

If you script doesn't take any parameters then you don't need to explicitly check for it do you?

If you have defined functions in "script A" for example and you want them available to "script B" you could call "script A" inside "script B" with ". script A"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0