SunQuest
           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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 31st, 2005, 02:44 AM
mikie7boy mikie7boy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 97 mikie7boy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 1 m 4 sec
Reputation Power: 6
calling self made scripts from within a script

Hello people, I'm working in the korn shell and i've come across this problem

I have a script called list which takes one argument which is working fine. Now if i write the following simple script and run it, it works fine (document is a file)

Code:
#/bin/ksh

list ./test/document


However if i re-write it to use a variable instead like so

Code:
#/bin/ksh

PATH=./test/document
list $PATH


I get the following error

scriptName[4]: list: not found

Can someone please tell me how i can call the list script from within another script using a variable as the argument

Cheers mike

Reply With Quote
  #2  
Old March 31st, 2005, 04:06 AM
zlutovsky zlutovsky is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Prague, Czech Rep.
Posts: 116 zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 34 sec
Reputation Power: 6
Quote:
Originally Posted by mikie7boy
Hello people, I'm working in the korn shell and i've come across this problem

I have a script called list which takes one argument which is working fine. Now if i write the following simple script and run it, it works fine (document is a file)

Code:
#/bin/ksh

list ./test/document


However if i re-write it to use a variable instead like so

Code:
#/bin/ksh

PATH=./test/document
list $PATH


I get the following error

scriptName[4]: list: not found

Can someone please tell me how i can call the list script from within another script using a variable as the argument

Cheers mike


Hello,

the computer always does, what you prescribe. You have rewritten the PATH variable which Unix uses to find programs you are calling. In your PATH variable was originaly the "dot" directory and after you have rewritten it, the system cannot locate the "list" command even if it is in the current directory.

The remedy is simple. Use anything else than PATH, i. e. MY_PATH and the system will find your "list" command.

Regards

Reply With Quote
  #3  
Old March 31st, 2005, 05:30 AM
mikie7boy mikie7boy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 97 mikie7boy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 1 m 4 sec
Reputation Power: 6
I knew it would be something simple

Thanks alot mate

Mike...

Reply With Quote
  #4  
Old March 31st, 2005, 08:08 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 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: 4 Days 19 h 44 m 45 sec
Reputation Power: 9
1. change #/bin/ksh
to #!/bin/ksh
do you see it ?
2. echo $PATH
3. if you want all contents of all subpath
use an appropriate 'sed' or 'perl' script
BTW: give to the thread a usefull title
calling self made scripts from within a script
is just stu..d
__________________
working on Solaris[5-9], preferred languages french and C.

Last edited by guggach : March 31st, 2005 at 08:14 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > calling self made scripts from within a script


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 4 hosted by Hostway