Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
8 user(s) are online (5 user(s) are browsing Forums)

Members: 0
Guests: 8

more...

Support us!

Headlines

 
  Register To Post  

How to made from shell commands some directory to be a default one while being in the other one ?
Home away from home
Home away from home


See User information
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.

Thanks!

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Home away from home
Home away from home


See User information
@kas1e

i don't thinkbthere is.

in my scripts i simply "cd" to where the other stuff should be done, do the stuff, and "cd" back

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Not too shy to talk
Not too shy to talk


See User information
@kas1e

I think there is only substitution for cuurent directory in destination parameter. Not for source
copy dir/something ""


but maybe I am wrong...

AmigaOS3: Amiga 1200
AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000
MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Not too shy to talk
Not too shy to talk


See User information
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.

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Just can't stay away
Just can't stay away


See User information
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.

Best regards,

Niels

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Just popping in
Just popping in


See User information
@nbache

Quote:
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.

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Not too shy to talk
Not too shy to talk


See User information
pushcd and popcd are in the finkel shell tools as well IIRC

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Not too shy to talk
Not too shy to talk


See User information
@nbache I don't think it uses assigns does it? I thought it used env vars

Go to top
Re: How to made from shell commands some directory to be a default one while being in the other one ?
Just can't stay away
Just can't stay away


See User information
@NinjaCyborg

This is how mine looks:

.key DIR

$VERPCD 40.1 (9.2.93)
This is a CD script that remembers the previous directory

IF "" EQ ""
  
Assign ofrom""
  
CD from:
  
Assign fromofrom:
  
Assign ofrom:
Else
  
Assign from""
  
CD 
EndIF


But of course msteed is right, I forgot about the internal PushCD/PopCD.

Best regards,

Niels

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project