Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save souhaiebtar/400b0f013a665229a7cf6d9b66e038cb to your computer and use it in GitHub Desktop.
Save souhaiebtar/400b0f013a665229a7cf6d9b66e038cb to your computer and use it in GitHub Desktop.
[create environment Variable no history] create environment Variable no history #powershell #bash #zsh #environment #variable
#### Powershell
# Prompt securely for the API Key
$apiKeyTemp = Read-Host "Enter your API Key"
# Set the environment variable using the temporary variable
$env:API_KEY = $apiKeyTemp
# Optional: Clear the temporary variable from memory
Remove-Variable apiKeyTemp
# Now you can use $env:API_KEY in subsequent commands in this session
# Example: Write-Host "Key set: $($env:API_KEY.Substring(0, 3))..."
----
Linux/Macos
### bash, make command start with space character ignored-not saved in bash_history
export HISTCONTROL=ignorespace # ~/.bashrc
### zsh, make command start with space character ignored-not saved in zsh_history
setopt HIST_IGNORE_SPACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment