Skip to content

Instantly share code, notes, and snippets.

@jonatanblue
Last active March 8, 2017 11:00
Show Gist options
  • Save jonatanblue/a63c91f8167566455071a611d5aeb001 to your computer and use it in GitHub Desktop.
Save jonatanblue/a63c91f8167566455071a611d5aeb001 to your computer and use it in GitHub Desktop.
Export secret variable on the command line without writing to history
#!/bin/bash
#
# Set a secret environment variable on the command line without saving it in history:
export MY_TOKEN="$(read token && echo ${token})"
# type/paste secret value
echo ${MY_TOKEN}
# value is echoed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment