From e71182ce0b1076f52799534bfed023c75e03e412 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 19 Jun 2017 00:28:06 +1200 Subject: Remove user@ prefix from prompt --- README.markdown | 16 ++++++++-------- bash/bashrc.d/prompt.bash | 4 ++-- ksh/kshrc.d/prompt.ksh | 4 ++-- sh/shrc.d/prompt.sh | 4 ++-- zsh/zshrc.d/prompt.zsh | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.markdown b/README.markdown index 36add541..bd4d482a 100644 --- a/README.markdown +++ b/README.markdown @@ -141,20 +141,20 @@ after testing `BASH_VERSINFO` appropriately. A terminal session with my prompt looks something like this: ~$ ssh remote - tom@remote:~$ cd .dotfiles - tom@remote:~/.dotfiles(master+!)$ git status + remote:~$ cd .dotfiles + remote:~/.dotfiles(master+!)$ git status M README.markdown M bash/bashrc.d/prompt.bash A init - tom@remote:~/.dotfiles(master+!)$ foobar + remote:~/.dotfiles(master+!)$ foobar foobar: command not found - tom@remote:~/.dotfiles(master+!)<127>$ sleep 5 & + remote:~/.dotfiles(master+!)<127>$ sleep 5 & [1] 28937 - tom@remote:~/.dotfiles(master+!){1}$ + remote:~/.dotfiles(master+!){1}$ -The username and hostname are elided if not connected via SSH. The working -directory with tilde abbreviation for `$HOME` is always shown. The rest of the -prompt expands based on context to include these elements in this order: +The hostname is elided if not connected via SSH. The working directory with +tilde abbreviation for `$HOME` is always shown. The rest of the prompt expands +based on context to include these elements in this order: * Whether in a Git repository if applicable, and punctuation to show repository status including reference to upstreams at a glance. Subversion diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 4dede32b..782af287 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -15,7 +15,7 @@ prompt() { # Basic prompt shape depends on whether we're in SSH or not PS1= if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION ]] ; then - PS1=$PS1'\u@\h:' + PS1=$PS1'\h:' fi PS1=$PS1'\w' @@ -86,7 +86,7 @@ prompt() { PS3='? ' PS4='+ ' if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION ]] ; then - PS1=$(id -nu)'@'$(hostname -s)'$ ' + PS1=$(hostname -s)'$ ' fi ;; diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh index 1aa05ae3..866cf79e 100644 --- a/ksh/kshrc.d/prompt.ksh +++ b/ksh/kshrc.d/prompt.ksh @@ -15,7 +15,7 @@ function prompt { # Basic prompt shape depends on whether we're in SSH or not PS1= if [[ -n $SSH_CLIENT ]] || [[ -n $SSH_CONNECTION ]] ; then - PS1=$PS1'$USER@${HOSTNAME%%.*}:' + PS1=$PS1'${HOSTNAME%%.*}:' fi # Add sub-commands; working directory with ~ abbreviation, VCS, job @@ -193,7 +193,7 @@ function prompt { PS3='? ' PS4='+ ' if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION ]] ; then - PS1=$(id -nu)'@'$(hostname -s)'$ ' + PS1=$(hostname -s)'$ ' fi ;; diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh index f1b67fb4..6f1e8e1f 100644 --- a/sh/shrc.d/prompt.sh +++ b/sh/shrc.d/prompt.sh @@ -5,7 +5,7 @@ unset PS1 PS2 PS3 PS4 PS1='$ ' PS2='> ' PS3='? ' PS4='+ ' # If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the -# username and hostname in PS1 too. +# hostname in PS1 too. if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] ; then - PS1=$(id -nu)'@'$(hostname)'$ ' + PS1=$(hostname)'$ ' fi diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh index 6ff82cec..7c695e25 100644 --- a/zsh/zshrc.d/prompt.zsh +++ b/zsh/zshrc.d/prompt.zsh @@ -11,7 +11,7 @@ prompt() { # Basic prompt shape depends on whether we're in SSH or not PS1= if [[ -n $SSH_CLIENT ]] || [[ -n $SSH_CONNECTION ]] ; then - PS1=$PS1'%n@%m:' + PS1=$PS1'%m:' fi PS1=$PS1'%~' @@ -49,7 +49,7 @@ prompt() { PS3='? ' PS4='+ ' if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION ]] ; then - PS1=$(id -nu)'@'$(hostname -s)'$ ' + PS1=$(hostname -s)'$ ' fi ;; -- cgit v1.2.3