Eric Wilson wrote:

Jerry;

I'm guessing this is a $PATH issue.  It sounds to me like the "current"
directory, or "." is not in your $PATH variable. As such, the niether
shell sh nor bash,  knows where to look for the script "logins"


To execute the script from the command line you can put the ./ or full pathc in front of the logins on the command line. Like so: ./logins , provided you are in the same directory os the script.

If you type echo $PATH,  the directory the "logins" is in , is probably
not in your $PATH.

Now, you could add "."  you your PATH variable,  but I wouldn't.  It is
considered a security risk.

What I would do is put the logins script in a non-OS utilities directory
like /usr/local/bin, or ~/bin,  and ensure those are in your PATH.

To add something to your PATH from the command line you would type
something like:  export PATH=$PATH:/usr/local/bin:~/bin

You woul also add something like the line above to your bash_profile or
.profiles, depending on your shell usage to get it updated at each login.


Cheers;

E!


Eric Wilson


I have a scrip in my home folder named: logins
It is listed in my home folder as:
-rwxrwxr-x   1 hub hub      23 Jan 28 22:12 logins

logins contains the following:
#!/bin/sh
date ; who ;

This is what I get with the command:
$ logins
bash: logins: command not found

This is what I expected:
$ logins
Fri Jan 28 22:24:12 CST 2005
hub :0           Jan 17 17:37
hub pts/1        Jan 28 22:23 (:0.0)


After more research I found the following in the PDF of "Red Hat Enterprise Linux 3: Red Hat Enterprise Linux Step By Step Guide" page 108.

"By adding paths to your .bash_profile, you can place utilities and programs in your path and be able to execute them without having to type ./ in front of the command."


I assumed the home directory was a default part of ones path. But $echo $PATH gave me:
$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/lib/jre/bin:/home/hub/bin:/usr/lib/jre/bin



I added my home directory to my home PATH environment in .bash_profile and the logins script now works without the ./ preceding the command. Is there a problem with adding home to ones path? Should I just move my practice scripts to /home/hub/bin and not put my home directory in my path? That seems to be a more logical place for them.


Thanks for the help.

--
Jerry Hubbard
[EMAIL PROTECTED]


_______________________________________________
CWE-LUG mailing list
http://www.cwelug.org/ [email protected]
http://lists.firepipe.net/listinfo/cwe-lug

Reply via email to