Re: shell: full path to currently executed script
- From: "Angel Tsankov" <fn42551@xxxxxxxxxxxxxxxx>
- Date: Fri, 19 May 2006 09:38:25 +0300
"Chris F.A. Johnson" <cfajohnson@xxxxxxxxx> wrote in message news:so3vj3-um8.ln1@xxxxxxxxxxxxxxxxxxxxxOn 2006-05-18, Angel Tsankov wrote:How can I obtain the full path to the currently executed script?
Why? There is generally no good reason to do that.
However, it is usally in $0.
Well, $0 does not always give the full path. Consider this:
echo 'echo "$0"' > a
chmod 700 a
pwd
stdout: /root
./a
stdout:./a
I need the last command to print /root/a, not ./a
I repeat: why do you need it? There is almost always a better way
to do whatever you really want to do.
I want to copy the files that reside in the same folder as the script to let's say /copy
OK, here's smoe more info:
I'm writing a couple of scripts that perform certain tasks, such as compiling and installing several packages. The scripts could reside on a floppy disk, a cd-rom or a hard drive, i.e. their location is not known in advance. This is because they are meant to be "generic" - end users may store them wherever they find appropriate. At some point the main script must execute one of the other scripts within a chroot'ed environment and here comes the need to copy the latter script to a location that is acessible within the chroot'ed environment. The root of the chroot'ed environment is known in advance. How do I accomplish this?
.
- Follow-Ups:
- Re: shell: full path to currently executed script
- From: Robert Hull
- Re: shell: full path to currently executed script
- References:
- shell: full path to currently executed script
- From: Angel Tsankov
- Re: shell: full path to currently executed script
- From: Chris F.A. Johnson
- Re: shell: full path to currently executed script
- From: Angel Tsankov
- Re: shell: full path to currently executed script
- From: Chris F.A. Johnson
- Re: shell: full path to currently executed script
- From: Angel Tsankov
- shell: full path to currently executed script
- Prev by Date: tools - retrive function list
- Next by Date: Re: Umlauts not being displayed in the shell
- Previous by thread: Re: shell: full path to currently executed script
- Next by thread: Re: shell: full path to currently executed script
- Index(es):
Relevant Pages
|