Date: Thu, 27 Oct 2016 21:29:12 -0500 From: Tim Daneliuk <tundra@tundraware.com> To: jd1008 <jd1008@gmail.com>, freebsd-questions@freebsd.org Subject: Re: Interesting $0 Problem Message-ID: <4c130a70-f191-ce52-5cb6-c8d1cf17c7fd@tundraware.com> In-Reply-To: <5812B617.5070701@gmail.com> References: <b859f7a3-51d1-06f4-e793-332edd212068@tundraware.com> <20161028014923.GA11638@fedora24> <a6931603-c2b2-1dc7-6997-ae896db90d88@tundraware.com> <5812B617.5070701@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 10/27/2016 09:21 PM, jd1008 wrote: > That's because your PATH variable first searched /usr/local/bin > so that is the name of the shell that is running. > For example, from the command line: > $ echo $0 > -ksh > > and my PATH variable looks like this: > > $ echo $PATH > /sbin:/usr/sbin:/bin:/usr/bin:/usr/libexec:/usr/local/bin:/opt/bin:/opt/schily/bin/: > So, my entry in the password file says my shell is /bin/ksh > $ grep jd /etc/passwd > jd:x:108o:1080:jd:/home/jd:/bin/ksh > > HTH. I guess I am dense. I get that the full qualified path to the shell should be there. I don't get why the "-" is prepended. This is not behavior I have seen on non-FreeBSD systems. > > > On 10/27/2016 07:53 PM, Tim Daneliuk wrote: >> On 10/27/2016 08:49 PM, Dutch Ingraham wrote: >>> On Thu, Oct 27, 2016 at 08:30:40PM -0500, Tim Daneliuk wrote: >>>> I was fidding with some shell code today and discovered it was breaking >>>> because $0 was returning "-/usr/local/bin/bash". Why is there a leading >>>> dash here? I've not seen that before. >>> How are you invoking the expansion, i.e., from a file or the >>> command-line? Is this a login shell? >>> >>> What do you get from the command-line with <echo "$0">? >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >>> >> >> My .bashrc source as standard startup profile: >> >> . mystartup >> >> Inside mystartup the folloing statement exists: >> >> source foo.sh >> >> $0 as reported in foo.sh is coming back with "-/usr/local/bin/bash"... >> > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- ---------------------------------------------------------------------------- Tim Daneliuk tundra@tundraware.com PGP Key: http://www.tundraware.com/PGP/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4c130a70-f191-ce52-5cb6-c8d1cf17c7fd>