Skip to content

Instantly share code, notes, and snippets.

@nullpo-head
Last active June 19, 2018 08:38
Show Gist options
  • Save nullpo-head/174a92ff56679bbdfcdbd1ae04c3ca3f to your computer and use it in GitHub Desktop.
Save nullpo-head/174a92ff56679bbdfcdbd1ae04c3ca3f to your computer and use it in GitHub Desktop.
OS icon PS script
# Set a simple prompt with an OS icon!
if [ `uname` = Darwin ]; then
SYSTEM_ICON=""
PS_COL=${PS_COL:="38;5;6"}
elif [ -n "`cat /proc/version | grep Microsoft`" ]; then
SYSTEM_ICON=""
PS_COL=${PS_COL:="38;5;70"}
elif [ `uname` = Linux ]; then
SYSTEM_ICON=""
PS_COL=${PS_COL:="38;5;39"}
fi
export PS1="\[\033[${PS_COL}m\]\W\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[${PS_COL}m\]${SYSTEM_ICON}\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment