I have this situation: I need to run some installer script being in some place. The installer script takes some directories from the root of the directory where it placed (but we not in that directory).
Is it possible to call some shell command telling that "this directory now the one which is root one" , while still being in other one when we run this script.
I.e. install script have let's say "copy dir1 to ram:", and it placed in "work:aaa/bbb/installer_script". So, being in any other directory i need to run "installer work:aaa/bbb/instller_script", and this "copy dir1 to ram" from this script should take dir1 from the place where this installer script is placed, and from the place where i am are.
Of course, it's easy to change the installer script itself, but just curious about some easy way to do what i need.
empty string "" can be used in the shell anywhere a path can be used, but refers only to the CD. / on it's own will get you the parent dir, // the parent of the parent and etc. Not sure about installer scripts.
So if you are in Devs/DOSDrivers and you want to be Prefs you can do //Prefs for example, and the implicit CD will take you there.
I'm not sure if this is the solution you want, but in S:Shell there is a small script called PCD which makes a CD, but remembers the dir you leave so you can get back to it afterwards.
So you could PCD to the dir where you want to be temporarily, and do what you want there, and then be back where you came from - if that makes sense?
BTW, the PCD script works by making temporary Assigns (which are global) and removing them again, quite clumsy I think. Maybe a nicer solution could be to set up the paths in local Shell variables and use them in your various CD commands or to prepend to the paths of the stuff you want to get or where you want to execute or whatever. But that's another story.
I'm not sure if this is the solution you want, but in S:Shell there is a small script called PCD which makes a CD, but remembers the dir you leave so you can get back to it afterwards.
PCD is kind of a holdover from OS3. OS4 also has the built-in PushCD and PopCD commands which do the same thing, but probably more elegantly.