cf shell helper

Skip to first unread message

Daniel Mikusa

May 30, 2014, 9:58:50 AM5/30/14
Thought I'd share a little helper script that I've been using lately, in case someone else might find it helpful too.  

I often find myself switching between CF installations and wanted an easy way to do it, so I put together this shell function.

Installation is easy, just add it to ~/.profile or save the file and source it.

Usage is like this...

- Run with no arguments to list the current and available environments.
- Run with one argument, to switch to that environment.  If the environment doesn't exist, it'll be initialized when you run cf for the first time.

Behind the scenes is nothing earth shattering, it's just adjusting the CF_HOME environment variable using the pattern "$HOME/.cf-<env-name>".  

Clean up is easy.  You can delete environments by simply deleting the "$HOME/.cf-<env-name>" folder.


Tao Deng

May 30, 2014, 10:22:43 AM5/30/14
This is fantastic and the thing what I need. It took too much time to switch among multiple cf endpoints,  also very hard to memorize all those urls, accounts, passwords.


James Bayer

May 30, 2014, 10:47:57 AM5/30/14
daniel, this is very very useful! thanks for sharing this. i'll make sure david lee sees this as i can easily see wanting to incorporate something like this into the CLI itself.

You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit

To unsubscribe from this group and stop receiving emails from it, send an email to

Thank you,

James Bayer

Wayne E. Seguin

May 30, 2014, 11:04:29 AM5/30/14
Incorporating environment switching/management into the CLI would be a welcome addition!

Reply all
Reply to author
0 new messages