The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 03:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
What is difference between "endl" and "\n"? krishna_sicsr High Level Programming 4 09-17-2007 05:02 PM
Where can I read about the difference between "..profile" and ".profile" zorrokan UNIX for Dummies Questions & Answers 2 09-05-2007 01:35 AM
what difference between "terminal" and "console" chenhao_no1 High Level Programming 1 09-09-2002 09:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-04-2008
ravi.sadani19 ravi.sadani19 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 42
Difference between "." and sh

Hi All,

I am using kshell and want to know difference between running ksh using "." and "sh"

When we should run by sh and "."

Thanks
  #2 (permalink)  
Old 06-04-2008
unilover unilover is offline
Registered User
  
 

Join Date: Mar 2008
Location: Toronto, Canada
Posts: 66
The dot-command (e.g.: . myscript.sh) means read in the file in the current shell and execute it line-by-line

On the other hand, executing any of the following:

sh myscript.sh
ksh myscript.sh
myscript.sh

(assuming that myscript.sh has +x for me) results in calling a child shell and executing myscript.sh in the child's environment.

Obviously, in the first form, any change in the environment (i.e. by commands like "cd <another-directory>") will happen in the current shell while in any of the second forms, they are happening in the child's environment and the current one is left unchanged.
Sponsored Links
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 03:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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