[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: running script files.



>>>>> "John" == John T Larkin <jlarkin@aij.st.hmc.edu> writes:

    John> On Feb 7, A. M. Varon wrote
    >> It seems that shell scripts i have made in my debian
    >> distrib. doesn't run.  you need to put ./ in front in order for
    >> it to execute.

    John> Bash will only execute programs which are specified in your
    John> path (to see what your path is, type "echo $PATH").  If "."
    John> is not in your path, then it won't execute programs in the
    John> current directory.  If you want to be able to execute things
    John> in the current directory without specifying the "./" before
    John> it, then try this (in bash): export PATH=$PATH:.  This will
    John> add "." to the end of your path.  To do this every time you
    John> log in (without retyping it every time), put that line in
    John> ~/.bashrc.  This is a script that is run every time a shell
    John> is started by you, and in particular, it is run when you log
    John> in.  -- - John Larkin - jlarkin@hmc.edu -
    John> http://aij.st.hmc.edu/~jlarkin

Bash will, by default, execute /etc/profile then ~/.bash_profile if it
is a login shell, but it won't execute .bashrc. That is executed on a
non-login invocation. As .bashrc has lots of stuff which one generally
wants on logins as well, usually these lines appear in .bash_profile:

	# Now read from .bashrc, if it exists
	if [ -f ~/.bashrc ];
	    then source ~/.bashrc;
	fi

That will ensure that all aliases, etc. are set up correctly. The info
node Bash Startup Files contains more information.

Cheers,

Graeme

-- 
| Graeme A Stewart, pgp public key  finger graeme@ariel.igeofcu.unam.mx	|
|  Key fingerprint =  AF C7 BF A4 52 D5 3C 3B  17 A5 62 43 DA 15 E8 97  |
|   "Keep a good head, and always carry a lightbulb."	Dylan		|


Reply to: