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
Command not working preethgideon UNIX for Dummies Questions & Answers 3 05-14-2008 11:56 AM
why is this command not working? wrapster UNIX for Advanced & Expert Users 1 05-02-2008 09:11 AM
Sed command not working shashi_kiran_v UNIX for Dummies Questions & Answers 9 11-15-2006 12:01 AM
cp command not working groundlevel UNIX for Dummies Questions & Answers 7 03-22-2006 01:48 PM
last command not working antalexi SUN Solaris 3 08-04-2005 10:22 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-01-2006
er_aparna er_aparna is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 52
cd command not working

Hello,

I am facing a strange problem while writing a script in ksh ....
though the script is too long but whenever i try to change the path to new path , the path is not changed...
like the path is :

?pwd
/osp/linus

?more script
echo "hello"
cd /osp
echo "bye"

?sh script
hello
bye

? pwd
/osp/linus

I tried all possible reasons , I am able to change via using a simple cd command but not via using it in a script........

Pls suggest what can be the possible reasons....

thanks in advance.....

Aparna
  #2 (permalink)  
Old 07-01-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
. script
  #3 (permalink)  
Old 07-01-2006
er_aparna er_aparna is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 52
Hello

Pls specify what is .script .......

i tried to execute the script by that but is not working.......

Pls advice and elaborate...

Thks again....
Aparna
  #4 (permalink)  
Old 07-01-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Quote:
Originally Posted by er_aparna
Pls specify what is .script .......

i tried to execute the script by that but is not working.......

Pls advice and elaborate...

Thks again....
Aparna
'script' is the name of your script [no pun] from your original post:
Code:
?more script
echo "hello"
cd /osp
echo "bye"
There's a space between '.' and 'script':
Code:
. script
  #5 (permalink)  
Old 07-03-2006
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Some shells may require that "." is in your PATH, so you may need to do
Code:
. ./script
  #6 (permalink)  
Old 07-03-2006
er_aparna er_aparna is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 52
Hi

Thanks it worked but I am curiuos to know why it happened ? i mean why i didnt worked with sh and wirked with bot .script and . ./script.....

what is reason for this behaviour...

Thks again
Aparna
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 02:39 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