[Bug 497765] Re: Karmic does not set PS1 correctly in /etc/profile

latimerio 497765 at bugs.launchpad.net
Thu Jul 7 14:43:50 UTC 2011


Thanks for the clarification, I got the point now.

I commented my /etc/profile as shown below so that also non-experts understand what it is about (and maybe become experts too some day).
My general issue of looking into this was the default value of PS1 which obfuscates the input line if I am too deep down in the filesystem hierarchy as then most of the input line is taken by the prompt.
If I want to know the path I can always look at the top window decoration, so I prefer \W instead of \w.

if [ "$PS1" ]; then       # if PS1 is defined, the shell is interactive
  if [ "$BASH" ]; then    # for bash
    PS1='\u@\h:\W\$ '     #  we define PS1 here
    if [ -f /etc/bash.bashrc ]; then
        . /etc/bash.bashrc
    fi
  else                    # non-bash interactive shells
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '            # use # as PS1 for root users
    else
      PS1='$ '            #  or $ as PS1 for other users
    fi
  fi
fi

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to base-files in Ubuntu.
https://bugs.launchpad.net/bugs/497765

Title:
  Karmic does not set PS1 correctly in /etc/profile

Status in “base-files” package in Ubuntu:
  Invalid

Bug description:
  Binary package hint: base-files

  /etc/profile contains wrong logic for PS1 (see below)
  Here the condition is entered when PS1 is already set otherwise nothing is done.
  That does not make sense to me.
  I think it should read if [ -z "$PS1" ]  or something similar, so that PS1 gets set if it is not already set.

  if [ $PS1 ]; then
    if [ "$BASH" ]; then
     ...
    else
     ...
    fi
  fi

  ProblemType: Bug
  Architecture: i386
  Date: Thu Dec 17 14:41:58 2009
  DistroRelease: Ubuntu 9.10
  Package: base-files 5.0.0ubuntu7
  ProcEnviron:
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcVersionSignature: Ubuntu 2.6.31-16.53-generic
  SourcePackage: base-files
  Uname: Linux 2.6.31-16-generic i686
  XsessionErrors:
   (gnome-settings-daemon:2058): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
   (gnome-settings-daemon:2058): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
   (nautilus:2090): Eel-CRITICAL **: eel_preferences_get_boolean: assertion `preferences_is_initialized ()' failed
   (polkit-gnome-authentication-agent-1:2114): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
   (firefox:3303): GLib-WARNING **: g_set_prgname() called multiple times

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/497765/+subscriptions




More information about the foundations-bugs mailing list