[K12OSN] Re: Run script from any directory (Krsnendu dasa)

Matt Oquist moquist-k12osn at majen.net
Mon Feb 28 19:24:11 UTC 2005


> From: "Krsnendu dasa" <krsnendu at orcon.net.nz>
> Subject: [K12OSN] Run script from any directory
> Very basic linux script question
> 
> I am trying to install smbldap
> 
> When I try to run ldap-useradd -m username 
> I get command not found message.
> 
> It only works when I change to the directory where these scripts live and
> type   #./ldap-useradd -m username
> 
> How can I change it so I can run it from any directory?

This is a basic question that applies the same way to any command line
shell - Unix, Linux, DOS.

Your "path" environment variable determines which directories are
searched for commands you type on the command line.

smbldap-tools version 0.8.6.* puts all its executables in
/opt/IDEALX/sbin/, so you need to add that to your user's PATH setting
if you don't want to do either of these every time you run one of
those scripts:

$ cd /opt/IDEALX/sbin/
$ ./smbldap-useradd blahblahblah
OR
$ /opt/IDEALX/sbin/smbldap-useradd blahblahblah

To view your current PATH setting:
$ echo $PATH

To TEMPORARILY change your path setting to include the smbldap-tools
directory:
$ export PATH="$PATH:/opt/IDEALX/sbin"

To "permanently" change your path setting to include the smbldap-tools
directory, you'll need to edit your shell configuration files.  First
check your .bash_profile, and then take a look at .bashrc.  (It's
a very good idea to know what's in these in any case.  'man bash' for
more details.)

Then add this line to your config:
export PATH="$PATH:/opt/IDEALX/sbin"

That should do it.

'man bash' documents the PATH setting.

--matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/k12osn/attachments/20050228/935ef9be/attachment.sig>


More information about the K12OSN mailing list