Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2008 15:57:06 -0000
From:      "Barry Byrne" <barry.byrne@wbtsystems.com>
To:        <stevefranks@ieee.org>, "'User Questions'" <freebsd-questions@freebsd.org>
Subject:   RE: home dir executable (!/bin/sh, chmod+x) shell scripts won't run without "sh <script>"
Message-ID:  <015801c85145$f3862ff0$c5010c0a@SUNYA>
In-Reply-To: <539c60b90801070752l3d0e571cq8f7b1b519e1e808c@mail.gmail.com>
References:  <539c60b90801070752l3d0e571cq8f7b1b519e1e808c@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

 
> -----Original Message-----
> From: owner-freebsd-questions@freebsd.org 
> [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Steve Franks
> Sent: 07 January 2008 15:53

> I keep reading about making sh scripts executable with #!/bin/sh on
> the first line and chmod to executable.  That works with all my system
> scripts (rc, etc.) or my system would be DOA, no doubt.  When I do it
> in my home folder, however, running <script> gives "command not
> found".  I've only read about 5 sites telling you how to make shell
> scripts executable, they all say the same thing, and they all don't
> work.  How did I get to be so special?
uestions-unsubscribe@freebsd.org"

Steve,

How are you running the commands? The problem is probably to do with your
path. Your home directory isn't typically and shouldn't be in your PATH (try
echo $PATH). You need to specify the full path to your scripts or place a ./
in front of the script name if in the same directory.

e.g. ./myscript.sh  or /home/username/myscript.sh

 - Barry




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?015801c85145$f3862ff0$c5010c0a>