Openstack CLI: Unset all variables beginning with prefix OS_

When using the Openstack CLI, you typically will get a shell script that you would source, which will export a bunch of variables to your session. I have run into the problem of switching between two different Openstack installs that were on different versions, and needed different variables. Also you will be need this when you will be generate parameters in different areas of scope for last version of keystone. Accordingly, the following example will unset all Openstack variables (all variables that begin with OS_)

Need create file with next content:

# ${!varprefix@} Matches all previously declared variables beginning with varprefix
unset ${!OS_@}

and use in next manner:

$ . ./
Scroll to top