2
base
   └──────install
   └──────setup
              └───myfile

Suppose this is a part of my directory structure in Unix. Is there any difference between these two:

1)

base/setup$ myfile

2)

base/install$ ../setup/myfile

I was trying to install something, and the second gave me some library dependency errors. I thought that these two methods are the same. Why is not that so?

  • The best way to realise this, I think, is to write full paths: base/setup/1.sh > base/setup/myfile base/install/1.sh > base/setup/myfile – Mikhail Chernykh Jul 30 '10 at 9:46
  • @netme: here ">" is not the redirection operator, I meant "base/setup>" as a command prompt. – Lazer Jul 30 '10 at 10:33
  • 1
    It would be better to include error messages or specific unexpected behavior in your question. "Did not work" provides no useful information. You may prefer ">" in your prompt, but when you show it to other people change it to "$" in order to reduce confusion. – Dennis Williamson Jul 30 '10 at 14:17
  • 1
    "Did not work"? Which means what exactly? – Lawrence Velázquez Jul 30 '10 at 16:08
  • 1
    @Lawrence Velázquez: got some library dependency errors. – Lazer Jul 30 '10 at 19:13
6

base/setup/myfile and base/install/../setup/myfile are the same file. The only explanation I can think of is that base/setup/myfile is referencing a file with a path relative to your current working directory (e.g: run ./modules/pre-setup) - in which case it may make a difference where you are when you run the script.

-1

it may not have worked as myfile could be trying to call or use things in current directory expecting to be located in the base/setup directory but you are in the base/install directory.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.