run file from different directory

10,532

First confirm that the configure script is present where you think it is. Second make sure that it's executable:

$ ls -l ./configure 
-rwxrwxr-x 1 saml saml 100 Jun  9 05:11 ./configure

If both of the checks are OK then you might want to try running configure by first changing directories to /mainfolder/execution and then running configure like this:

$ cd /mainfolder/execution
$ ../configure

You also might want to try it this way:

$ cd /mainfolder
$ ./configure execution

EDIT #1

According to comments left by OP, the following directory structure appears to be what he's describing:

$ tree -f
.
`-- /mainfolder
    `-- /mainfolder/execution
        `-- /mainfolder/execution/configure
Share:
10,532

Related videos on Youtube

Dchris
Author by

Dchris

Updated on September 18, 2022

Comments

  • Dchris
    Dchris over 1 year

    I have a directory mainfolder with a subdirectory execution which contains a configure script. I can switch to the execution directory and run ./configure and it works fine. Now I'm trying to figure out how to run the configure script when I'm in mainfolder. I tried:

    ./configure /execution
    

    and:

    ./configure execution
    

    but neither worked. I also tried the same thing using the full path either starting from root directory or from user directory like this:

    ./configure /home/etc/user/mainfolder/execution
    ./configure user/mainfolder/execution
    

    I always got the message:

    bash: ./configure: No such file or directory

    Finally, I tried:

    /home/etc/user/mainfolder/execution/configure 
    . /home/etc/user/mainfolder/execution/configure
    

    Both gave me the error:

    sed: can't read makefile.in: No such file or directory

    How can I do this?

    • nitin
      nitin almost 11 years
      @Dchris , could you run file /home/etc/user/mainfolder/execution/configure and if its a script or ascii text do a grep -A5 -B5 "sed" file /home/etc/user/mainfolder/execution/configure and paste the result here ? ..... it might be that the makefile.in which i think sed is supposed to make change/update to might be missing or the path might have been changed. This was we can confirm it.
    • Dchris
      Dchris almost 11 years
      @NSD Updated result in my question
    • nitin
      nitin almost 11 years
      @Dchris , sorry .... forgot to remove the 'file' from the grep
    • nitin
      nitin almost 11 years
      @Dchris ,thank you .. the sed command is substituting some values from/to the makefile.in descriptor file .... the makefile.in seems to be mentioned a bit below in the command than what has been reported back by the grep command ..... you would need to locate that makefile.in and change the path/location so that it is accessible in the /home/etc/user/mainfolder/execution/configure directory then it should work fine
    • Dchris
      Dchris almost 11 years
      @NSD makefile.in file is located in the same directory as configure file is
    • Dchris
      Dchris almost 11 years
      @NSD What does "sed -e 's/src_pat1/replace_txt1/g' -e 's/src_pat2/replace_txt2/g' makefile.in" does?
    • nitin
      nitin almost 11 years
      do a man sed .... you will get all the details there.
  • Dchris
    Dchris almost 11 years
    $ ls -l ./configure command is ok when i run it in execution directory but when i run it in mainfolder directory i have the message "ls:cannot access"
  • Dchris
    Dchris almost 11 years
    ./configure execution didn't work
  • slm
    slm almost 11 years
    Does my edit reflect what dir. structure you have? If this is correct, then you can't run configure the way you've been trying to.
  • Dchris
    Dchris almost 11 years
    what is tree -f?
  • slm
    slm almost 11 years
    I'm glad you were able to solve you issue but in the future, please try and ask your question correctly and give accurate information. I realize this might be difficult given your new to Linux, but your question and all these answers is of little value to the Unix & Linux site as a whole. As you refine your question through comments and your own research feel free to update and refine your question. At this point you've wasted a lot of peoples time and left a bit of a mess here now with this useless question. I don't mean this in a rude way at all, I'm just trying helping you to understand.
  • slm
    slm almost 11 years
    A Unix command to list the directory structure. Almost all Unix commands (such as tree and ls) have what are called man pages. You can find out more about a command in your shell by typing man ls or man tree. Here's tree's man page: computerhope.com/unix/tree.htm. Incidentally don't try this with configure, this isn't a program, it's a script that's part of the software you're trying to install.
  • Mjachowdhury
    Mjachowdhury about 8 years
    This doesn't do the job anyhow, does it? You end up in the execution directory as your current working directory after doing this command.
  • Mjachowdhury
    Mjachowdhury about 8 years
    The actual answer is here: stackoverflow.com/questions/786376/…