Skip to content

Instantly share code, notes, and snippets.

@akatz
Created March 10, 2012 01:11
Show Gist options
  • Save akatz/2009542 to your computer and use it in GitHub Desktop.
Save akatz/2009542 to your computer and use it in GitHub Desktop.
function instance_role {
grep instance_role /etc/chef/dna.json |awk -F\" '{print $4}'
}
function instance_id {
grep this /etc/chef/dna.json |awk -F\" '{print $4}'
}
function public_hostname {
ohai |grep public_hostname | awk -F\" '{print $4}'
}
function instance_name {
grep `public_hostname` /etc/chef/dna.json -B 1 |grep "\"name\"" |awk -F\" '{print $4}'
}
PS1="\[\033[01;31m\]`instance_role` `instance_id` `instance_name`\[\033[01;34m\] \W \$\[\033[00m\]"
@akatz
Copy link
Author

akatz commented Mar 10, 2012

turns
ip-10-88-234-138 ~ # source .bashrc
into:
util i-9377c7f7 ~ $

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment