Set system-wide variables macosx

to set the $SHELL env var permanently do it through

sudo su && /bin/bash

this line opens with bash non-interactive shell

it then uses ~/.bashrc to set system wide vars

vim ~/.bashrc

log out of shell then go back in

lets edit the file to load files from /etc/profile.d

vim ~/.bashrc

Below is another way for login shells

When a bash shell is created, lets say through opening up your terminal app or opening up a terminal in vscode, under the hood it openings up a bash interactive terminal using this command

bash --login

or

a bash interactive shell is just that, a shell a user plans to interactive with. but to create a shell through a ssh connection expects no user interaction because it can be ran programmatically. Both interactive and non interactive shells launch differently, executing different files when initialized. watch the video above and read the article below to look deeper into this

https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#:~:text=When%20Bash%20is%20invoked%20as,profile%20%2C%20if%20that%20file%20exists.

lets set system wide env vars on a interactive zsh or bash shell

vim /etc/profile
for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null 2>&1
        fi
    fi
done
mkdir /etc/profile.d
vim /etc/profile.d/werm.path.sh

insert

export wow="damn"

You have to create a completely new interactive shell. in order for updates to be made

by simple typing “bash”, “zsh” or “sh” and creating a new shell, your updates will not take effect

Leave a Reply

Your email address will not be published.