neylitalo Posted November 10, 2007 Share Posted November 10, 2007 I need to know the default bash PS1 variable, usually set in /etc/bashrc or /etc/bash/bashrc, could someone post the relevant lines here? If you don't feel like digging, the entire file will do just as well. If you don't have GNU/Linux or some other Unix derivative, then you don't have what I need, but thanks anyway. Quote Link to comment https://forums.phpfreaks.com/topic/76744-default-bash-ps1/ Share on other sites More sharing options...
steviewdr Posted November 10, 2007 Share Posted November 10, 2007 Ubuntu (located in: /etc/bash.bashrc): # System-wide .bashrc file for interactive bash(1) shells. # To enable the settings / commands in this file for login shells as well, # this file has to be sourced in /etc/profile. # If not running interactively, don't do anything [ -z "$PS1" ] && return # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. # If this is an xterm set the title to user@host:dir #case "$TERM" in #xterm*|rxvt*) # PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' # ;; #*) # ;; #esac # enable bash completion in interactive shells #if [ -f /etc/bash_completion ]; then # . /etc/bash_completion #fi # sudo hint if [ ! -e $HOME/.sudo_as_admin_successful ]; then case " $(groups) " in *\ admin\ *) if [ -x /usr/bin/sudo ]; then cat <<-EOF To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. EOF fi esac fi # if the command-not-found package is installed, use it if [ -x /usr/bin/command-not-found ]; then function command_not_found_handle { /usr/bin/command-not-found $1 return $? } fi Debian etch: # System-wide .bashrc file for interactive bash(1) shells. # To enable the settings / commands in this file for login shells as well, # this file has to be sourced in /etc/profile. # If not running interactively, don't do anything [ -z "$PS1" ] && return # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. # If this is an xterm set the title to user@host:dir #case "$TERM" in #xterm*|rxvt*) # PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' # ;; #*) # ;; #esac # enable bash completion in interactive shells #if [ -f /etc/bash_completion ]; then # . /etc/bash_completion #fi Centos: # /etc/bashrc # System wide functions and aliases # Environment stuff goes in /etc/profile # By default, we want this to get set. # Even for non-interactive, non-login shells. if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi # are we an interactive shell? if [ "$PS1" ]; then case $TERM in xterm*) if [ -e /etc/sysconfig/bash-prompt-xterm ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm else PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"' fi ;; screen) if [ -e /etc/sysconfig/bash-prompt-screen ]; then PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen else PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"' fi ;; *) [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default ;; esac # Turn on checkwinsize shopt -s checkwinsize [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " fi if ! shopt -q login_shell ; then # We're not a login shell # Need to redefine pathmunge, it get's undefined at the end of /etc/profile pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|$1($|" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } for i in /etc/profile.d/*.sh; do if [ -r "$i" ]; then . $i fi done unset i unset pathmunge fi # vim:ts=4:sw=4 PS1='\u@\h:\w\$ ' -steve Quote Link to comment https://forums.phpfreaks.com/topic/76744-default-bash-ps1/#findComment-388636 Share on other sites More sharing options...
neylitalo Posted November 10, 2007 Author Share Posted November 10, 2007 Hm... it seems that Gentoo is the odd man out when it comes to setting PS1 in the bashrc file. Ah, well. Thanks for the rc's, Steve. Quote Link to comment https://forums.phpfreaks.com/topic/76744-default-bash-ps1/#findComment-388644 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.