I'm trying to export a bash function during Gnome login using one of the login shell start-up scripts. I've tried doing it in ~/.profile and ~/.xprofile but it results in X dying and restarting at the login screen.
I am able to export environment variables from these scripts without problems during Gnome login; only exporting a function (any function, regardless of content) kills X.
I can also source both scripts from a terminal and the function is exported as expected without any problems. The function also gets exported fine if the scripts are invoked by a bash login shell (
bash -l) from a terminal.
Why is exporting a function at Gnome login killing X? / Can I do anything to fix it?
(I realise I could export the function from .bashrc, but using a profile is more convenient in my situation and I'd like to understand why this crash is happening.)