Hot answers tagged

16

There are two shells involved here: The calling shell, the interactive shell from which you are running this The non-login, non-interactive shell, spawned by bash -c Now, the problem is, within double quotes the variables are expanded to their respective values, this is true for any shell. So, as you have used double quotes, the variable expansion, $v, ...


3

In the transcript output from your make command, you should notice the important part: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_CA:en", LC_ALL = (unset), LC_PAPER = "it_IT.UTF-8", LC_ADDRESS = "it_IT.UTF-8", LC_MONETARY = "it_IT.UTF-8", LC_NUMERIC = "it_IT.UTF-8", ...


3

sudo sanitizes the environment before running any command. In doing so, if the value of the directive secure_path is set, it will be used as the PATH for the sudo commands, not the current PATH. In my system: % sudo grep -E 'secure_path' /etc/sudoers Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" So i have: % echo ...


3

It is not possible. As you have correctly observed, your script is executing in its own shell. This shell gets a copy of its parent shell's environment when it is forked, and it has no way to access the parent shell's environment. And that is good, because otherwise scripts could have all kinds of unforeseen side effects. ;) In order to change variables in ...


2

sudo sanitizes the environment and by default only keeps certain environment variables available with modifying the values of some (e.g. PATH). You can pass the variable ANDROID_HOME manually: sudo ANDROID_HOME="/actual/path" ionic run android Or preserve the current environment: sudo -E ionic run android


2

Probably your .bashrc or .profile is messedup. Your gedit will not start if it is not in path and since your path is empty it is not in the path. You should first establish a good enough path. export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin And then you should be able to start gedit. Alternativelly you could just run gedit with ...


1

Use the -l option on su to get a full user login: su -l ubuntu That should give you the ubuntu environment you expect.



Only top voted, non community-wiki answers of a minimum length are eligible