If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to call a script from other folder

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-12-04, 03:20
freelancers freelancers is offline
Registered User
 
Join Date: Jul 2004
Posts: 5
Exclamation How to call a script from other folder

Hello friends,

I have another question about the shell script,let say i have a script namecompress and this script is put under a folder name folder1. In folder2 i have another script name's call_compress, if i want to call the "compress" script (to compress every folder in "folder1")from folder2, how i want to do that.
I try to write "/bin/sh /home/simonteh/folder1/compress" in the call_compress script ( but it doesn't work) Hope someone can will help me!!

Thank you very much

Best Regards,
Freelancers
Reply With Quote
  #2 (permalink)  
Old 08-12-04, 09:53
chrisgu chrisgu is offline
Registered User
 
Join Date: Aug 2004
Posts: 2
I would suggest you create a script to look in the folder list all the files and then call your compress script.

for dr in "/home/simonteh/folder1/compress"
do
compress "$dr"
done

Chris
Reply With Quote
  #3 (permalink)  
Old 08-13-04, 14:29
deebee deebee is offline
Registered User
 
Join Date: Jul 2004
Posts: 45
How about this?. Add the following line call_compress code.

. /home/simonteh/folder1/compress

make sure there is a dot(.) in the beginning!
Reply With Quote
  #4 (permalink)  
Old 08-17-04, 00:01
freelancers freelancers is offline
Registered User
 
Join Date: Jul 2004
Posts: 5
sorry ./home..... not working

. /home/simonteh/folder1/compress not working as i want...coz the result is same... it will zip all the files at the folder where you call the script...
Reply With Quote
  #5 (permalink)  
Old 08-17-04, 06:09
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Post your scripts!
Reply With Quote
  #6 (permalink)  
Old 08-17-04, 15:17
deebee deebee is offline
Registered User
 
Join Date: Jul 2004
Posts: 45
Quote:
Originally Posted by freelancers
. /home/simonteh/folder1/compress not working as i want...coz the result is same... it will zip all the files at the folder where you call the script...
you have not exactly specified whats you'r other script doing! So, u better post ur script! and you will find better ans.
Reply With Quote
  #7 (permalink)  
Old 08-23-04, 09:55
romanov romanov is offline
Registered User
 
Join Date: Aug 2004
Posts: 3
Cool

just write this line there in the script
"sh /home/simonteh/folder1/compress #arguments if any"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On