Skip to content

Instantly share code, notes, and snippets.

@gilles
Created February 11, 2011 19:03
Show Gist options
  • Save gilles/822828 to your computer and use it in GitHub Desktop.
Save gilles/822828 to your computer and use it in GitHub Desktop.
Change the PS1 on your provisioned machines (chef)
# /etc/profile.d/prompt.sh
# Chef managed
extra=""
<%- @color ||= '' %>
if type rvm-prompt >/dev/null 2>&1; then
extra+="\[\e[1;36m\](\$(rvm-prompt i v g)) "
fi
export PS1="<%= @color %>[\u@\h] \[\e[1;35m\]\w\[\e[0m\] $extra\[\e[0m\]\$ "
#my own PS1 with a RED date on prod, YELLOW on staging
case node[:app_environment]
when 'production' then color = '\[\e[0;31m\]'
when 'staging' then color = '\[\e[0;33m\]'
else color = ''
end
template "/etc/profile.d/prompt.sh" do
source "prompt.sh.erb"
mode "0644"
owner "root"
group "root"
backup 0
variables(
:color => color
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment