Last active
April 15, 2022 23:29
-
-
Save superatomic/8f22ada9864c85984d51e0cc6fae4250 to your computer and use it in GitHub Desktop.
OUTDATED Xshe v0.3.2 Example – Cross-Shell Environment Variable Configuration
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 IS OUTDATED; DO NOT USE IT! ## | |
## ⚠️ UPDATED VERSION: https://gist.github.com/superatomic/52a46e53a4afce75ede4db7ba6354e0a ## | |
## ======================================================================================== ## | |
############################################################################################## | |
# Original file contents is as follows: | |
############################################################# | |
# Cross-Shell Environment Variable Configuration using Xshe # | |
# https://github.com/superatomic/xshe # | |
############################################################# | |
# These lines add the environment variables for the XDG Base Directory Specification. | |
# (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) | |
# We need to use $HOME instead of ~, because ~ is not expanded. | |
XDG_CONFIG_HOME = "$HOME/.config" | |
XDG_DATA_HOME = "$HOME/.local/share" | |
XDG_STATE_HOME = "$HOME/.local/state" | |
XDG_CACHE_HOME = "$HOME/.cache" | |
# Another environment variable! | |
BIN_HOME = "$HOME/.local/bin" | |
# Now, we set up another environment variable that is relative to $XDG_DATA_HOME. | |
# Because environment variables are added in the order that they appear in this file, | |
# we can be sure that $XDG_DATA_HOME will be set before we set this variable. | |
CARGO_HOME = "$XDG_DATA_HOME/cargo" | |
# Declaring paths should be done with an array of values, like this. | |
# Xshe will join them together in the correct way based on the shell that is being used. | |
PATH = ["$PATH", "$BIN_HOME", "$CARGO_HOME/bin"] | |
# We can evaluate dynamic variable values like this. | |
# Here, we set the variable $EDITOR to the location of the editor nano, wherever it is on the system. | |
EDITOR = "$(which nano)" | |
# Now, we can set environment variables for specific shells instead of all of them: | |
[shell.bash] | |
# $HISTFILE will only be set to this file for bash | |
HISTFILE = "$XDG_STATE_HOME/bash_history" | |
[shell.zsh] | |
# $HISTFILE will only be set to this file for zsh | |
HISTFILE = "$XDG_STATE_HOME/zsh_history" | |
# We can also set more values only for zsh: | |
ZDOTDIR = "$XDG_CONFIG_HOME/zsh" | |
ZSH_CACHE_DIR = "$XDG_CACHE_HOME/oh-my-zsh" | |
[shell.fish] | |
# And also some fish-only environment variables: | |
fish_greeting = "Welcome to fish, human" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment