generated from sosiristseng/template-mkdocs-material
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ecd04e
commit 4f89d79
Showing
14 changed files
with
81 additions
and
83 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: Environment variables | ||
tags: | ||
- windows | ||
- linux | ||
draft: true | ||
--- | ||
|
||
## Linux | ||
|
||
[Arch Wiki: environment variables](https://wiki.archlinux.org/index.php/environment_variables) | ||
|
||
=== "System-wide" | ||
|
||
- `/etc/profile` is sourced by all POSIX-compatible shells upon login. | ||
- Files inside the `/etc/profile.d/` directory will also be sourced. | ||
|
||
=== "Bash" | ||
|
||
- `~/.profile` or `~/.bash_profile` for login bash instances. | ||
- `~/.bashrc` for every interactive bash instance. | ||
|
||
=== "Zsh" | ||
|
||
- `~/.zshenv` for environment variables in all zsh instances. | ||
- `~/.zprofile` for every login zsh instance. | ||
- `~/.zshrc` for every interactive zsh instance. | ||
|
||
!!! note | ||
zsh [does not source](https://superuser.com/questions/187639/zsh-not-hitting-profile) `~/.profile` by default. You can add this line to `~/.zprofile` or `~/.zshenv` to let zsh login shells read `~/.profile` | ||
|
||
```zsh title="~/.zshenv" | ||
test -r ${HOME}/.profile && emulate sh -c 'source ${HOME}/.profile' | ||
``` | ||
|
||
=== "X windows" | ||
|
||
- `~/.xinitrc` is sourced by `startx`. | ||
- `~/.xprofile` is sourced by display managers (e.g. GDM, SDDM) | ||
|
||
=== "Systemd" | ||
|
||
- `~/.config/environment.d/*.conf`: sourced by `systemd`. Also used in WayLand sessions where `xinitrc` and `xprofile` is not available. | ||
|
||
## Windows | ||
|
||
[Environment variables in Powershell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.3) | ||
|
||
### Shell variables | ||
|
||
Variables created by `set` are bound to the current session and not persistent. | ||
|
||
```powershell | ||
$Env:FOO = "example" | ||
$Env:FOO | ||
``` | ||
|
||
### Persistent variables | ||
|
||
- GUI: Windows Settings -> Advanced system settings -> Set **Environment Variables**. | ||
- CLI: `SetEnvironmentVariable` function. | ||
|
||
```powershell | ||
[Environment]::SetEnvironmentVariable('Foo', 'Bar', 'Machine') | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.