Skip to content

Instantly share code, notes, and snippets.

@azet
Created May 27, 2013 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azet/5659213 to your computer and use it in GitHub Desktop.
Save azet/5659213 to your computer and use it in GitHub Desktop.
-- Author: Aaron <azet@azet.org> Zauner
-- License: MIT License (http://opensource.org/licenses/mit-license.php)
-- Description:
whatis("Changes PS1 color depending on the host category (e.g. login, compute,..) in the cluster")
family("syscommon")
hostname = os.getenv("HOSTNAME")
if string.match(hostname, "dmn") then
setenv("PS1", "\\e[45m \\e[0m \\[\\e]0;\\u@\\h: \\w\\a\\]\\u@\\e[0;35m\\h\\e[0m [\\w]> ")
elseif string.match(hostname, "login") then
setenv("PS1", "\\e[43m \\e[0m \\[\\e]0;\\u@\\h: \\w\\a\\]\\u@\\e[0;33m\\h\\e[0m [\\w]> ")
elseif string.match(hostname, "sac") then
setenv("PS1", "\\e[41m \\e[0m \\[\\e]0;\\u@\\h: \\w\\a\\]\\u@\e[0;31m\\h\\e[0m [\\w]> ")
else -- assume compute node
setenv("PS1", "\\e[46m \\e[0m \\[\\e]0;\\u@\\h: \\w\\a\\]\\u@\\e[0;36m\\h\\e[0m [\\w]> ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment