For Borg Backup I wanted to defined environment variables
without adding them to
~/.bash_history. In the man page I found
Default settings on a fresh Debian Buster installation:
borg@borg:~$ set | grep HIST HISTCONTROL=ignoreboth HISTFILE=/mnt/backup/borg/.bash_history HISTFILESIZE=2000 HISTSIZE=1000
This environment variable controls how the executed commands are added to the history file. Multiple settings can be set, separated by a colon.
ignorespace: All commands starting with a space will not be added to the history. So you just need to start the environment variable declaration with a space.
ignoredups: Prevents adding repeated/duplicate commands to the history
erasedups: Remove all duplicate commands from the history before adding the new ones.
HISTCONTROL="ignorespace:erasedups" export HISTCONTROL
Path to the history file.
If undefined, no history is created.
HISTSIZE & HISTFILESIZE
Number of commands which will stored in the history and history file.