Re: shell: full path to currently executed script

"Chris F.A. Johnson" <cfajohnson@xxxxxxxxx> wrote in message news:so3vj3-um8.ln1@xxxxxxxxxxxxxxxxxxxxx
On 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
stdout: /root

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