17 Feb 2002 14:27:46 +0900: In attempt to throw the authorities off his trail,
Charles Muller <[EMAIL PROTECTED]> transmitted:

> 
> I had thought that I could run this file by going to the /chuck
> directory and typing the file name. But it doesn't run. I get the
> response:
> 
> bash: backup: command not found
> 
> Can someone tell me what I am missing here? I am sorry to be so slow.

Chuck,

The "backup" script is a program. BASH only looks for programs which are in
your PATH environment variable (e.g., /bin;/sbin;/usr/bin/;/usr/local/bin...
etc.) unless you specify the path to the executable.

Now you can run your backup script in two ways ('$' means normal user BASH
prompt):

$ /chuck/backup

or 

$ cd /chuck/
$ ./backup # this means you tell the interpreter to look in the current
directory not in the PATH

But both those options involve typing, and I hate typing (well, excessive
typing, that is)!

I would recommend either of the following:

1. Create a subdirectory within /chuck called /bin and then add that to your
path by modifying your .bashrc, or

2. Add an alias in your .bashrc which
points to /chuck/backup

Just open your ~/.bashrc file in any text editor and you can find both the
list of aliases (towards the top) and the PATH variable (at the bottom). The
above changes should be self-explanatory.

I prefer the first alternative since it inclines you towards sticking all
executable scripts in one directory, instead of having them clutter up your
/chuck/ directory. As a general rule, put all the stuff that belongs together,
like maintenance scripts in its own directory.

Hope that helps.

- Chris

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to