2

From within the GUI, I'm seeing this result:

My problem is exactly that this does not happen in the terminal run under the graphical user interface; neither in Ubuntu 16.04.3 or 18.04. – Thomas Arildsen Oct 1 '18 at 11:57

for the env.sh script which I've added:

thufir@dur:~$ 
thufir@dur:~$ ll /etc/profile.d/
total 56
drwxr-xr-x   2 root root  4096 Jan 29 15:51 ./
drwxr-xr-x 148 root root 12288 Aug 19 20:50 ../
-rw-r--r--   1 root root    96 Aug  6  2018 01-locale-fix.sh
-rw-r--r--   1 root root   825 Oct 15  2018 apps-bin-path.sh
-rw-r--r--   1 root root   664 Apr  1  2018 bash_completion.sh
-rw-r--r--   1 root root  1003 Dec 29  2015 cedilla-portuguese.sh
-rwxr-xr-x   1 root root   321 Jan 29 15:51 env.sh*
-rw-r--r--   1 root root  1024 Jan 29 15:51 .env.sh.swp
-rw-r--r--   1 root root   687 Aug 23  2018 input-method-config.sh
-rwxr-xr-x   1 root root  1253 Dec 16  2018 rvm.sh*
-rw-r--r--   1 root root  1945 Oct 10  2018 vte-2.91.sh
-rw-r--r--   1 root root   954 Oct  5  2018 xdg_dirs_desktop_session.sh
thufir@dur:~$ 

However, switching to a virtual console and logging, I can run printenv, grep the results, and see new variables as defined in the script:

#!/bin/sh
export AccessToken=678
export AccessTokenSecret=wxy
export ApiKey=abc
export ApiSecret=123

I've tried source .bashrc but that doesn't seem to run the scripts in /etc/profile.d/. How can I re-load or run those from within the GUI?

I'm using gnome shell and bash; older system:

thufir@dur:~$ 
thufir@dur:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.10
Release:    18.10
Codename:   cosmic
thufir@dur:~$ 

and:

thufir@dur:~$ 
thufir@dur:~$ echo $XDG_SESSION_TYPE 
x11
thufir@dur:~$ 
Thufir
  • 4,551
  • 1
    What's the name of the file? Which display manager are you using? – Gunnar Hjalmarsson Jan 30 '20 at 00:20
  • I'll check that out, source /etc/profile.d/env.sh works. – Thufir Jan 30 '20 at 00:20
  • not sure what display manager. unity? default for whatever installed, pardn @GunnarHjalmarsson the file is env.sh which I can source from the gui console. – Thufir Jan 30 '20 at 00:21
  • @Thufir: No, I mean are you using LightDM, GDM or something else? The file name is ok - I just wondered if the .sh extension was there. – Gunnar Hjalmarsson Jan 30 '20 at 00:23
  • it's the env.sh file, @GunnarHjalmarsson; updated the q. Not sure about LightDM or GDM, pardon, I'll have to look into that. the GUI console is gnome terminal. – Thufir Jan 30 '20 at 00:29
  • Files like /etc/profile.d/foo.sh are sourced by the default /etc/profile file - which is loaded for login shells like the one invoked when you log in at the CLI virtual console but not when a GUI terminal emulator invokes a non-login interactive shell (although at least for gnome-terminal, there's a checkbox to Run command as a login shell) . – steeldriver Jan 30 '20 at 00:38
  • @steeldriver: In graphical sessions, they are sourced by the display manager at login and made environment variables which are available through the whole session. See for instance /etc/gdm3/Xsession. (Not sure about Wayland in this respect, though.) – Gunnar Hjalmarsson Jan 30 '20 at 00:49
  • 1
    @Thufir: Then you most likely have GDM. Are you possibly using Wayland? You can check by running this command: echo $XDG_SESSION_TYPE – Gunnar Hjalmarsson Jan 30 '20 at 00:54
  • different OS, @GunnarHjalmarsson but it comes back as X 11 – Thufir Jan 02 '21 at 02:45

0 Answers0