Hi Sam,

Quiring, Sam wrote:

> #! /bin/bash
> pwd
> echo $_
>
> #! /bin/bash
> echo $_
> pwd
>
> The first one displays:
> /home/windriver/changes/NexS-235r1/with-camera
> pwd
>
> The second one displays:
> ./apply.sh
> /home/windriver/changes/NexS-235r1/with-camera

That's what $_ is advertised to do: it expands to the last
argument to the previous command, after expansion (or the full
pathname to the shell or shell script if there was no previous
command).  You're probably looking for $(which $0) or something
similar.

Hope that helps,
Jonathan

Reply via email to