This function exports what is piped to it (in stdin
) as an environment variable.
Add this function to your .zshrc
, .bashrc
, etc.
Use this function at the end of a command, as in:
http -a my-client:secret -f POST :9000/oauth2/token grant_type=client_credentials scope=message.read | jq -r .access_token | exp ACCESS_TOKEN