Date: Mon, 6 Jun 2016 05:27:39 -0400 From: Baho Utot <baho-utot@columbus.rr.com> To: "Kevin P. Neal" <kpn@neutralgood.org> Cc: freebsd-questions@freebsd.org Subject: Re: sh[it] and What am I missing here? Message-ID: <5b25bfd2-0410-568e-35c8-a6b5a65ff0ed@columbus.rr.com> In-Reply-To: <20160606022031.GA35165@neutralgood.org> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5b25bfd2-0410-568e-35c8-a6b5a65ff0ed>