From owner-freebsd-questions@freebsd.org Fri Oct 28 02:29:45 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E65EEC23FDF for ; Fri, 28 Oct 2016 02:29:45 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from oceanview.tundraware.com (oceanview.tundraware.com [45.55.60.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "oceanview.tundraware.com", Issuer "oceanview.tundraware.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AB79BAF8 for ; Fri, 28 Oct 2016 02:29:45 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from [192.168.0.2] (ozzie.tundraware.com [75.145.138.73]) (authenticated bits=0) by oceanview.tundraware.com (8.15.2/8.15.2) with ESMTPSA id u9S2TH8O075610 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 27 Oct 2016 21:29:17 -0500 (CDT) (envelope-from tundra@tundraware.com) Subject: Re: Interesting $0 Problem To: jd1008 , freebsd-questions@freebsd.org References: <20161028014923.GA11638@fedora24> <5812B617.5070701@gmail.com> From: Tim Daneliuk Message-ID: <4c130a70-f191-ce52-5cb6-c8d1cf17c7fd@tundraware.com> Date: Thu, 27 Oct 2016 21:29:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5812B617.5070701@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (oceanview.tundraware.com [45.55.60.57]); Thu, 27 Oct 2016 21:29:18 -0500 (CDT) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: u9S2TH8O075610 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2016 02:29:46 -0000 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 ? >>> _______________________________________________ >>> 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/