Bash function not working…

Paul Smith paul at mad-scientist.net
Tue Jan 8 17:12:06 UTC 2013


On Tue, 2013-01-08 at 18:07 +0100, Johnny Rosenberg wrote:
> Can I just run the .bash-functions file
> (after given it run permissions), for example?

No.  Running it would have it start a subshell, the subshell would
create all those functions, then the sub-shell would then exit... and
all the new functions you just defined in that subshell would be lost.

You have to source the file, not run it (and it doesn't need to be
executable--in fact you should not make it executable so people don't
execute it by accident), so that it will take effect in the current
shell instead.

Use either:

	. .bash-functions

or:

	source .bash-functions

(the latter is a Bash extension which doesn't work in POSIX standard
shells).






More information about the ubuntu-users mailing list