<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 13, 2015, at 12:53, Steve VanSlyck <<a href="mailto:s.vanslyck@postpro.net" class="">s.vanslyck@postpro.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<title class=""></title>
<div class=""><div class="">I have a script. The first line is<br class=""></div>
<div class=""> </div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">#!/bin/bash</b></span><br class=""></div>
<div class=""> </div>
<div class="">When I run the script, I get a command not found error:<br class=""></div>
<div class=""> </div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">[root@vslaw2 ~]# server_setup.sh</b></span><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class=""><br class=""></b></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">-bash: server_setup.sh: command not found</b></span><br class=""></div></div></div></blockquote><div><br class=""></div><div>UNIX looks for binaries and scripts in your PATH (echo $PATH). Since . isn't in your path, you need to provide the path to the command you're trying to run. You've almost certainly seen this syntax before - the most common way is to be in the directory where the script lives, and use ./ (dot slash) like so:</div><div><br class=""></div><div>./server_setup.sh</div><div><br class=""></div><div>. means the same thing it does in DOS/Windows - refers to the current working directory.</div><div><br class=""></div><div>Note - I've never seen anyone put . in their UNIX path and I wouldn't recommend it. IIRC the reason behind this -- it ensures that when you run (for example) visudo, you're getting the real /usr/sbin/visudo and not a rogue binary in whatever the current directory happens to be. /usr/sbin tends to be more secured from tampering than some other random directory on the filesystem where you might be while trying to execute visudo (again, visudo is just an example) from.</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class="">
<div class="">I see bash at /bin . . .<br class=""></div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">[root@vslaw2 ~]# ls -lsap /bin/bash<br class=""></b></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">884 -rwxr-xr-x 1 root root 904872 Oct 16 2014 /bin/bash</b></span><br class=""></div>
<div class=""> </div>
<div class="">. . . and my script appears to have the correct permissions<br class=""></div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">[root@vslaw2 ~]# ls -lsap server_setup.sh<br class=""></b></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, "courier new", monospace, sans-serif;"><b class="">8 -rwxr-xr-x 1 root root 4232 May 13 13:40 server_setup.sh</b></span><br class=""></div>
<div class=""> </div>
<div class="">Anyone have an idea what I'm doing wrong?<br class=""></div>
<div class=""> </div>
<div class=""> </div>
<div class=""><span class="colour" style="color: #ff0000">(And by the way I seriously appreciate all the help!)</span><br class=""></div>
<div class=""> </div>
<div class=""> </div>
<div class="">Steve<br class=""></div>
</div>
_______________________________________________<br class="">colug-432 mailing list<br class=""><a href="mailto:colug-432@colug.net" class="">colug-432@colug.net</a><br class="">http://lists.colug.net/mailman/listinfo/colug-432<br class=""></blockquote></div><br class=""></body></html>