Hi Jonathan, Thanks for taking the time. I get it now. I am sorry to have bothered you
-Sam -----Original Message----- From: Jonathan Nieder [mailto:jrnie...@gmail.com] Sent: Thursday, September 01, 2011 2:27 PM To: Quiring, Sam Cc: bug-bash@gnu.org; b...@packages.debian.org Subject: Re: pwd as first command changes script behavior 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