⚙️ Unique ID
z-shell/zsh-unique-id
This plugin provides a unique number that identifies a running Z shell session, in its shell variable $ZUID_ID
. Besides this unique number, also a unique codename is provided, in the shell variable $ZUID_CODENAME
. Once you load this plugin, the two parameters will be set, and their values will not be available to other Zshell sessions (being thus unique). $ZUID_ID
is a progressing number starting from 1
. $ZUID_CODENAME
is chosen from a list of predefined codenames, see the default list below. An example use case is to hold logs in files .../mylog-${ZUID_CODENAME}.log
so that two different Z shells will not write to the same file at the same time.
Default code names are:
- atlantis (for
ZUID_ID
==1
) - echelon (for
ZUID_ID
==2
) - quantum (for
ZUID_ID
==3
and etc.) - ion
- proxima
- polaris
- solar
- momentum
- hyper
- gloom
- velocity
- future
- enigma
- andromeda
- saturn
- jupiter
- aslan
- commodore
- falcon
- persepolis
- dharma
- samsara
- prodigy
- ethereal
- epiphany
- aurora
- oblivion
Zstyle configuration allows to customize the codenames:
zstyle :plugin:zuid codenames paper metal wood plastic # first 4 shells will have those codenames
Install Zsh Unique ID
- Standalone
- Zi
- Zgen
- Oh-My-Zsh
Unpack zsh-unique-id
to the chosen location and add to .zshrc
:
source {where-zsh-unique-id-is}/zsh-unique-id.plugin.zsh
Sourcing is recommended, because it can be done early, at top of zshrc, without a plugin manager – to acquire the unique identification as early as possible.
Add the following to your .zshrc
file. Zi will clone the plugin the next time you start zsh. To update issue zi update z-shell/zsh-unique-id
.
zi load z-shell/zsh-unique-id
Add zgen load z-shell/zsh-unique-id
to your .zshrc
file in the same place you're doing your other zgen load
calls in.
Clone the Repository:
git clone https://github.com/z-shell/zsh-unique-id.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-unique-id
And add zsh-unique-id
to your plugin list.