UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 19th, 2005, 09:22 PM
calvinscy calvinscy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Kuala Lumpur, Malaysia
Posts: 77 calvinscy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 50 m 9 sec
Reputation Power: 4
Build .sh file?

I create a .sh file called cfg.sh, contents are as follow:

./configure --enable-so

I set this file to executable and type ./cfg.sh to execute it. It work fine as what I expected!

So, I create another file called cfgpath.sh, contents are as follow:

PATH=/usr/local/bin:$PATH; export PATH;
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

I do the samething, set the .sh file to executable and type ./cfgpath.sh to run the unix script. But it doesn't perform. If I type echo $PATH, path did not set.

I perfrom the path setting directly from # prompt and it work.

Why?

Thanks in advance.

Reply With Quote
  #2  
Old July 20th, 2005, 01:21 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,098 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 Days 9 h 5 m 46 sec
Reputation Power: 9
Quote:
Originally Posted by calvinscy
I create a .sh file called cfg.sh, contents are as follow:

./configure --enable-so

I set this file to executable and type ./cfg.sh to execute it. It work fine as what I expected!

So, I create another file called cfgpath.sh, contents are as follow:

PATH=/usr/local/bin:$PATH; export PATH;
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

I do the samething, set the .sh file to executable and type ./cfgpath.sh to run the unix script. But it doesn't perform. If I type echo $PATH, path did not set.

I perfrom the path setting directly from # prompt and it work.

Why?

Thanks in advance.


ypu have tou SOURCE the file

---> . ./filename

note the dot before ./filename
__________________
working on Solaris[5-9], preferred languages french and C.

Reply With Quote
  #3  
Old July 20th, 2005, 02:05 AM
calvinscy calvinscy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Kuala Lumpur, Malaysia
Posts: 77 calvinscy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 50 m 9 sec
Reputation Power: 4
Quote:
Originally Posted by guggach
ypu have tou SOURCE the file

---> . ./filename

note the dot before ./filename


I did use ./filename, as follow

./cfgpath.sh

Reply With Quote
  #4  
Old July 20th, 2005, 09:40 AM
stdunbar stdunbar is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: May 2004
Location: Superior, CO, USA
Posts: 1,730 stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level)stdunbar User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 23 h 22 m 53 sec
Reputation Power: 375
Send a message via ICQ to stdunbar Send a message via Yahoo to stdunbar
You didn't look at what guggach said. Look again - there are two dots in what was posted. This does assume Borne or Korn shell, but based on your syntax it seems like you are already using one of those.

Reply With Quote
  #5  
Old July 21st, 2005, 09:08 PM
calvinscy calvinscy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Kuala Lumpur, Malaysia
Posts: 77 calvinscy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 50 m 9 sec
Reputation Power: 4
Quote:
Originally Posted by stdunbar
You didn't look at what guggach said. Look again - there are two dots in what was posted. This does assume Borne or Korn shell, but based on your syntax it seems like you are already using one of those.


I'm using

./cfg.sh

it is working, why when I use

./cfgpath.sh

is not working? I know you suggest to use ../cfgpath.sh
instead ./cfgpath.sh. But why? What is the reason behine it?
I also wondering why the .sh script one can work, the other
NOT?

Enjoy your happy weekend!!

Reply With Quote
  #6  
Old July 22nd, 2005, 03:24 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 184
Quote:
Originally Posted by calvinscy
I'm using

./cfg.sh

it is working, why when I use

./cfgpath.sh

is not working? I know you suggest to use ../cfgpath.sh
instead ./cfgpath.sh. But why? What is the reason behine it?
I also wondering why the .sh script one can work, the other
NOT?

Enjoy your happy weekend!!

DOT - SPACE - DOT - SLASH ...

The first dot is a command!

It does not work because a child cannot set the parent's environment. The "dot" prevents spawning a child process.

hth,
M.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Build .sh file?


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT