Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2004
    Posts
    5

    Exclamation Unanswered: 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

  2. #2
    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

  3. #3
    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!

  4. #4
    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...

  5. #5
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Post your scripts!

  6. #6
    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.

  7. #7
    Join Date
    Aug 2004
    Posts
    3

    Cool

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •