Results 1 to 4 of 4
Hello to everyone,
I'm not actually a newbie but the question could have an answer so simple that I could feel as a beginner ... so here it is:
is ...
- 06-18-2008 #1Just Joined!
- Join Date
- Jun 2008
- Posts
- 2
absolute paths starting from another path
Hello to everyone,
I'm not actually a newbie but the question could have an answer so simple that I could feel as a beginner
... so here it is:
is there a special character or a tricky way to refer to an absolute path while typing another (relative or absolute) path? For example:
I wish to refer to /usr/bin/ls while typing something like "../####/usr/bin/ls" or "/etc/####/usr/bin/ls" where #### is the answer I'm looking for.
Background (aka "while would you need to do that?????"):
I have to deal with a proprietary command-line software. The software accepts as input a file where, besides other data, I can specify an optional output log. According to the software docs, I should be able to use an absolute path, like for example /tmp/log . Nonetheless, there must be a bug, since the program, when executed, returns an error like
"cant' create DIR//tmp/log"
where the prepended DIR (usually a relative path, but could also be absolute) depends on other parameters given to the executable, but I wish the input file to be as general as possible, so I can't use a simple relative path in there.
A very dirty solution (functional in most cases, but not general) could be putting a "../../../../ .... ../tmp/log" with dozens of ../ , but I was wondering if there is a more elegant solution.
Thank you
- 06-19-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
I don't quite understand the question.
You already know how to handle absolute and relative paths. I can't think of any other -logical- way that could be possible to specify a path.
Particularly, I don't understand when you say "../####/usr/bin/ls". Because it's the same than just "../usr/bin/ls"... no idea what do you mean there.
I highly doubt that the problem with your program is something related to paths. I would check that the directory exists, and that the user who runs the program (note that some daemons do not run as root, but with their own user name) has write, exec and read permissions on that directory.
- 06-19-2008 #3Just Joined!
- Join Date
- Jun 2008
- Posts
- 2
Thank you for your answer.
The problem is that the path created by the program does indeed not exist, since it's not the path I want to use.
If I wish to write to the file "/tmp/output.log", the program tries to write the file "SOMEPATH/tmp/output.log", prepending SOMEPATH (that can be relative or absolute) to the absolute path I indicated. Sadly, there is no way to prevent the executable to add the SOMEPATH at the beginning.
Therefore, the #### I am looking for (frankly, I don't think it exists, but asking can be always useful) is some kind of special character or escape sequence that reduces SOMEPATH/####/tmp/output.log to the absolute path /tmp/output.log (discarding everything before the ####).
Thank you again
- 06-19-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Ok. I now understand
Well, what you want does not exist but, still, you have many options:
- look into the program man page, help, config files and documentation, even ask on their forums, mailings lists, etc. and see if that path can be somewhat configured
- edit the sources, change the path, and recompile, this should be trivial even if you don't know programming, and you can always ask for help here (though this is only possible if the program is open source)
- make a symlink, for example, you can link /foot/tmp.... to /tmp, this way, the file will be written into /tmp, though it will still be accesible in the previous location...
I hope this helps in any way.


Reply With Quote
