From owner-freebsd-questions@freebsd.org Mon Jun 6 09:27:41 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 24387B6B460 for ; Mon, 6 Jun 2016 09:27:41 +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.226]) by mx1.freebsd.org (Postfix) with ESMTP id E04991107 for ; Mon, 6 Jun 2016 09:27:40 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from [75.187.32.8] ([75.187.32.8:53364] helo=raspberrypi.bildanet.com) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 07/16-01062-B0245575; Mon, 06 Jun 2016 09:27:39 +0000 Received: from [192.168.1.40] (helo=baho-utot.bildanet.com) by raspberrypi.bildanet.com with esmtp (Exim 4.84) (envelope-from ) id 1b9qot-0006yM-Ce; Mon, 06 Jun 2016 05:27:39 -0400 Subject: Re: sh[it] and What am I missing here? To: "Kevin P. Neal" 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> <5fd48d4e-0ca9-681b-83af-da18280f4979@columbus.rr.com> <20160606022031.GA35165@neutralgood.org> Cc: freebsd-questions@freebsd.org From: Baho Utot Message-ID: <5b25bfd2-0410-568e-35c8-a6b5a65ff0ed@columbus.rr.com> Date: Mon, 6 Jun 2016 05:27:39 -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: <20160606022031.GA35165@neutralgood.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.130: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: Mon, 06 Jun 2016 09:27:41 -0000 On 06/05/16 22:20, Kevin P. Neal wrote: > On Sun, Jun 05, 2016 at 01:49:32PM -0400, Baho Utot wrote: >> On 06/05/16 13:40, Ernie Luzar wrote: >>> 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. > No, if this is the case you are doing something weird. The filename does > not matter, and the extension is just part of that filename. > > A shell script should start with the "#!" line (the "shebang" line) as the > very first line, and it should have the executable bits set. It will then > run with the interpreter specified in the initial shebang line. That is, > when run from a command line. And it must be either in your path or have > the path to it specified (like the "./" prefix mentioned earlier in the > thread assuming the script is in the current directory). > > If you run a shell script by giving it as an argument to an invocation of > a shell command then you are bypassing both the shebang line and the > executable bits. This will tend to give surprising results. Don't do that. > Are you saying the following is bad? sh my.fault I always use this layout cat my.fault.sh #!/bin/sh # Do a bunch of stupid things ..... # Then try to figure out what happened .... printf "%s\n" "Run Complete" BTW are you Cowboy Neal?