From owner-freebsd-questions@freebsd.org Sun Jun 5 17:40:30 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 00D24B6A36E for ; Sun, 5 Jun 2016 17:40:30 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C3A3F11F1 for ; Sun, 5 Jun 2016 17:40:29 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-it0-x22e.google.com with SMTP id f67so26530476ith.1 for ; Sun, 05 Jun 2016 10:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-transfer-encoding; bh=Fj2sDf5GZ9MsapDcDZShbsuE3TNhY5vQj9DwMxSvg/U=; b=pJ0r4Aj2NE0vhf2ZAQtJiUfMcBYEB33f/b3JrHNYmGYTn284Dv+weSJmW3NOxhIVsz oTDqJH37N27WXUyYQwMAH5iRS0wAXKD7HMoThCHzw4rNyD6PbE3PuaxVj6qB9GlB8uez no0ykkzBJx+iv9zqqJJgVDyKElVnF5n2rxbw+rcF2JQUg14qIzJQzJMv9+/EDBuBIBrr 0tZnJGlf9ckyArf6SGAjJpO1YMbg7AnaGQGGvyNz0YfVm2kO8pQz3NeMYavaL+jyKSyW cm19TsqeSY88QC6G0ihup/KE0A7Tzz0AXwKJ5+me6foGc8CwBqo+YsOwUxg1lCjEFoPR VSjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-transfer-encoding; bh=Fj2sDf5GZ9MsapDcDZShbsuE3TNhY5vQj9DwMxSvg/U=; b=GONKdg/K/lYdNDZ/bjzTOqHVe5e/k5746srPzN+KcNleh/V8X37yz8Gfqi1WXZsaSA lYAHLBU0iDeY2YxxstR3Bd0qGdneFUiSA/YiyS3XQ/sNhtTWMqd/ZcBlD81umuwuhsDT kcPF6LgCk2jtbx6RiUAaykBXp4UrBeWzGRaN87Ob3SwFM9USKKMatBHSJlpyK9MrIyVZ 8m6q63DqrMoUyyJI63ifHJnklMKvhNst8SwrFOGD0VOPIWWt46lB8CJIgd+nBeoKH9PX 49ZjxdDpUZ+Tk8DyAViP5U1Xff0LVWg+5dEXQjbt6+Vv31qZ0MkguaDCOKw2XXdR9xPc GxnA== X-Gm-Message-State: ALyK8tK62utCkH0aABaw17W2qIQPxirgEBWEtfkgoWop59IbGw1n28cF267htYZzPLNb5Q== X-Received: by 10.36.66.68 with SMTP id i65mr11748343itb.91.1465148429094; Sun, 05 Jun 2016 10:40:29 -0700 (PDT) Received: from [10.0.10.3] (cpe-184-56-210-236.neo.res.rr.com. [184.56.210.236]) by smtp.googlemail.com with ESMTPSA id v136sm4347271ita.3.2016.06.05.10.40.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Jun 2016 10:40:28 -0700 (PDT) Message-ID: <5754641A.8010508@gmail.com> Date: Sun, 05 Jun 2016 13:40:42 -0400 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Baho Utot CC: freebsd-questions@freebsd.org 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> In-Reply-To: <4daed7a2-9a0b-15d9-0bb2-31227f8fcddd@columbus.rr.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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:40:30 -0000 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. 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.