From owner-freebsd-questions@freebsd.org Sun Jun 5 17:49:34 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 E5382B6A78C for ; Sun, 5 Jun 2016 17:49:34 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.228]) by mx1.freebsd.org (Postfix) with ESMTP id AA7EC1A92 for ; Sun, 5 Jun 2016 17:49:33 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from [75.187.32.8] ([75.187.32.8:52988] helo=raspberrypi.bildanet.com) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id EB/1E-11286-D2664575; Sun, 05 Jun 2016 17:49:33 +0000 Received: from [192.168.1.40] (helo=baho-utot.bildanet.com) by raspberrypi.bildanet.com with esmtp (Exim 4.84) (envelope-from ) id 1b9cB2-0006h4-Oh for freebsd-questions@freebsd.org; Sun, 05 Jun 2016 13:49:32 -0400 Subject: Re: sh[it] and What am I missing here? References: <31b2cfb1-1da8-9262-3f03-d964776c905e@columbus.rr.com> <575453F9.9070508@holgerdanske.com> <4daed7a2-9a0b-15d9-0bb2-31227f8fcddd@columbus.rr.com> <5754641A.8010508@gmail.com> To: freebsd-questions@freebsd.org From: Baho Utot Message-ID: <5fd48d4e-0ca9-681b-83af-da18280f4979@columbus.rr.com> Date: Sun, 5 Jun 2016 13:49:32 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <5754641A.8010508@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jun 2016 17:49:35 -0000 On 06/05/16 13:40, Ernie Luzar wrote: > Baho Utot wrote: >> On 06/05/16 12:31, David Christensen wrote: >>> On 06/05/2016 08:38 AM, Baho Utot wrote: >>> ... >>>> root@baho-utot:~ # set >>> ... >>>> shell /bin/csh >>> ... >>>> tcsh 6.18.01 >>> ... >>>> OK tcsh as I thought >>> ... >>>> OK switch shells >>>> >>>> root@baho-utot:~ # /bin/sh >>>> # set >>> ... >>>> Why is the SHELL variable still set to /bin/csh >>> ... >>> >>> Because you are invoking a program (/bin/sh) and that program did >>> not modify the SHELL environment variable. >>> >>> >>> On 06/05/2016 09:15 AM, jd1008 wrote: >>> > Do I understand correctly that you want bash to be your shell? >>> > If so, you can run (as root), the command >>> > chsh >>> >>> +1 >>> >>> Take a look at: >>> >>> https://www.freebsd.org/doc/en/articles/linux-users/shells.html >>> >>> >>> David >> >> I understood that, But I do not want to change the default shell. >> I only want to create a script ( sh script ) and run if from a clean >> machine with just base install nothing else and then run my sh script >> to build some ports. That's were the trouble lies. ie functions not >> returning status for example: >> >> test.sh >> chmod +x test.sh >> >> #!/bin/sh >> >> func() { >> echo "Yep it's me" >> return 1 >> } >> >> if [ func ] ; then # if [ 1 = func ] or if [ 1 -eq >> func ] doesn't work either >> echo "This works" >> fi >> >> ./test.sh >> >> [: func: unexpected operator > > I think your problem is where you are placing your script. > You have to place your script in a path that is auto searched for > executable scripts. > ./ fixes that > Place your script in /usr/local/bin on your development pc and on the > new installed os pc. Then just entering the script on the console > command line will cause it to execute. BY the way your script doesn't > need to be suffixed with .sh to work. It does need the suffix .sh because if it is missing I fail to function...... the computer does just fine.