neuen Prompt erstellen - gibt probleme

S

seeadler

Tripel-As
hallo,
benötige eure hilfe,

habe
Code:
etc/profile
profile nach /home/max kopiert und folgende zeile eingebaut
Code:
PS1 = '\u@\h - \d, \t - \w \$'

eigentlich müsste mein prompt so aussehen:
Code:
max@puma - Di Mär 27, 21:01:35 - max $
leider tut sich da aber gar nichts.........
mein prompt sieht nach wie vor so aus:
Code:
max@puma
kann mir da jemand weiterhelfen?
 
Falsche Datei.
Versuch mal:
Code:
~/.bashrc
für den user
Code:
/root/.bashrc
für root
 
Die Einstellungen der ROOT-Shell zu veraendern ist wie ohne Seil zu klettern. Die ROOT-Shell sollte unbedingt unveraendert bleiben, da im Notfall sie die einzige nocht funktionsfaehige Shell sein koennte.
 
ich habe nur eine
Code:
bash.bashrc
hab's mit der versucht, leider ohne erfolg, habe genau den gleichen vorgang wie mit
Code:
profile
gemacht
an der linux-distribution dürfte es doch eigentlich nicht scheitern, ich habe
Code:
opensuse 10.2
 
Die Einstellungen der ROOT-Shell zu veraendern ist wie ohne Seil zu klettern. Die ROOT-Shell sollte unbedingt unveraendert bleiben, da im Notfall sie die einzige nocht funktionsfaehige Shell sein koennte.

Naja wozu gibts Knoppix und so?^^
 
die root-shell möchte ich auch nicht verändern, diese einstellung möchte ich jediglich auf den user vollziehen
 
Naja wozu gibts Knoppix und so?^^
Ich denke, dass du das nicht ernst gemeint hast. ;)
Ein System sollte ohne Knoppix stabil laufen, und an der ROOT-Shell rumbasteln ist einfach Quatsch. Aber wer meint das machen zu muessen, bitte!
 
Wie hades schon sagt:
/etc/profile besser in Ruhe lassen!

Ich habe bei mir einfach ne ~/.bashrc angelegt, und dort die Einstellungen für die lokale shell vorgenommen.
Weiss aber nicht genau, wie SuSE das handhabt.
 
Ich habe bei mir einfach ne ~/.bashrc angelegt, und dort die Einstellungen für die lokale shell vorgenommen.
Wenn also Login-Shell des Users auch die bash angegeben ist, dann sollte das so auch funktionieren, ansonsten erst einmal mit 'usermod' die Einstellungen korrekt vornehmen.
 
der inhalt meiner
Code:
bash.bashrc
ist:
Code:
# /etc/bash.bashrc for SuSE Linux
#
# PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes
# will be lost during system upgrades.  Instead use /etc/bash.bashrc.local
# for your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...

#
# Check which shell is reading this file
#
if test -z "$is" ; then
 if test -f /proc/mounts ; then
  case "`ls --color=never -l /proc/$$/exe`" in
    */bash)	is=bash ;;
    */rbash)	is=bash ;;
    */ash)	is=ash  ;;
    */ksh)	is=ksh  ;;
    */pdksh)	is=ksh  ;;
    */zsh)	is=zsh  ;;
    */*)	is=sh   ;;
  esac
 else
  is=sh
 fi
fi

#
# ksh/ash soemtimes do not know
#
test -z "$UID"  && readonly  UID=`id -ur 2> /dev/null`
test -z "$EUID" && readonly EUID=`id -u  2> /dev/null`

#
# Colored file listings
#
if test -x /usr/bin/dircolors ; then
    #
    # set up the color-ls environment variables:
    #
    if test -f $HOME/.dir_colors ; then
	eval "`dircolors -b $HOME/.dir_colors`"
    elif test -f /etc/DIR_COLORS ; then
	eval "`dircolors -b /etc/DIR_COLORS`"
    fi
fi

#
# ls color option depends on the terminal
# If LS_COLROS is set but empty, the terminal has no colors.
#
if test "${LS_COLORS+empty}" = "${LS_COLORS:+empty}" ; then
    LS_OPTIONS=--color=tty
else
    LS_OPTIONS=--color=none
fi
if test "$UID" = 0 ; then
    LS_OPTIONS="-A -N $LS_OPTIONS -T 0"
else
    LS_OPTIONS="-N $LS_OPTIONS -T 0"
fi

#
# Avoid trouble with Emacs shell mode
#
if test "$EMACS" = "t" ; then
    LS_OPTIONS='-N --color=none -T 0';
    tset -I -Q
    stty cooked pass8 dec nl -echo
fi
export LS_OPTIONS

#
# Set prompt and aliases to something useful for an interactive shell
#
case "$-" in
*i*)
    #
    # Some useful functions
    #
    startx  () {
	test -x /usr/bin/startx || {
	    echo "No startx installed" 1>&2
	    return 1;
	}
	/usr/bin/startx ${1+"$@"} 2>&1 | tee $HOME/.xsession-errors
    }

    remount () { /bin/mount -o remount,${1+"$@"} ; }

    #
    # Set prompt to something useful
    #
    case "$is" in
    bash)
	# Force a reset of the readline library
	unset TERMCAP
	# Returns short path (last two directories)
	spwd () {
	  ( IFS=/
	    set $PWD
	    if test $# -le 3 ; then
		echo "$PWD"
	    else
		eval echo \"..\${$(($#-1))}/\${$#}\"
	    fi ) ; }
	# Set xterm prompt with short path (last 18 characters)
	ppwd () {
	    local _t="$1" _w _x _u="$USER" _h="$HOST"
	    test -n "$_t"    || return
	    test "${_t#tty}" = $_t && _t=pts/$_t
	    test -O /dev/$_t || return
	    _w="$(dirs +0)"
	    _x=$((${#_w}-18))
	    test ${#_w} -le 18 || _w="...${_w#$(printf "%.*s" $_x "$_w")}"
	    printf "\e]2;%s@%s:%s\007\e]1;%s\007" "$_u" "$_h" "$_w" "$_h" > /dev/$_t
	    }
	# If set: do not follow sym links
	# set -P
	#
	# Other prompting for root
	_t=""
	if test "$UID" = 0 ; then
	    _u="\h"
	    _p=" #"
	else
	    _u="\u@\h"
	    _p=">"
	    if test \( "$TERM" = "xterm" -o "${TERM#screen}" != "$TERM" \) \
		    -a -z "$EMACS" -a -z "$MC_SID" -a -n "$DISPLAY"
	    then
		_t="\$(ppwd \l)"
	    fi
	    if test "${BASH##*/}" = "rbash" ; then
		_t=""
	    fi
	fi
	# With full path on prompt
	PS1="${_t}${_u}:\w${_p} "
#	# With short path on prompt
#	PS1="${_t}${_u}:\$(spwd)${_p} "
#	# With physical path even if reached over sym link
#	PS1="${_t}${_u}:\$(pwd -P)${_p} "
	unset _u _p _t
	;;
    ash)
	cd () {
	    local ret
	    command cd "$@"
	    ret=$?
	    PWD=$(pwd)
	    if test "$UID" = 0 ; then
		PS1="${HOST}:${PWD} # "
	    else
		PS1="${USER}@${HOST}:${PWD}> "
	    fi
	    return $ret
	}
	cd .
	;;
    ksh)
	# Some users of the ksh are not common with the usage of PS1.
	# This variable should not be exported, because normally only
	# interactive shells set this variable by default to ``$ ''.
	if test "${PS1-\$ }" = '$ ' ; then
	    if test "$UID" = 0 ; then
		PS1="${HOST}:"'${PWD}'" # "
	    else
		PS1="${USER}@${HOST}:"'${PWD}'"> "
	    fi
	fi
	;;
    zsh)
#	setopt chaselinks
	if test "$UID" = 0; then
	    PS1='%n@%m:%~ # '
	else
	    PS1='%n@%m:%~> '
	fi
	;;
    *)
#	PS1='\u:\w\$ '
	PS1='\h:\w\$ '
	;;
    esac
    PS2='> '

    if test "$is" = "ash" ; then
	# The ash shell does not have an alias builtin in
	# therefore we use functions here. This is a seperate
	# file because other shells may run into trouble
	# if they parse this even if they do not expand.
	test -s /etc/profile.d/alias.ash && . /etc/profile.d/alias.ash
    else
	unalias ls 2>/dev/null
        case "$is" in
	bash) alias ls='ls $LS_OPTIONS'		;;
	zsh)  alias ls='/bin/ls $=LS_OPTIONS'	;;
	*)    alias ls='/bin/ls $LS_OPTIONS'	;;
	esac
	alias dir='ls -l'
	alias ll='ls -l'
	alias la='ls -la'
	alias l='ls -alF'
	alias ls-l='ls -l'

	#
	# Set some generic aliases
	#
	alias o='less'
	alias ..='cd ..'
	alias ...='cd ../..'
	alias cd..='cd ..'
	if test "$is" != "ksh" ; then
	    alias -- +='pushd .'
	    alias -- -='popd'
	fi
	alias rd=rmdir
	alias md='mkdir -p'
	if test "$is" = "bash" ; then
	    #
	    # Other shells use the which command in path (e.g. ash) or
	    # their own builtin for the which command (e.g. ksh and zsh).
	    #
	    _which () {
		local file=$(type -p ${1+"$@"} 2>/dev/null)
		if test -n "$file" -a -x "$file"; then
		    echo "$file"
		    return 0
		fi
		hash -r
		type -P ${1+"$@"}
	    }
	    alias which=_which
	fi
	alias rehash='hash -r'
	alias you='su - -c "/sbin/yast2 online_update"'
	if test "$is" != "ksh" ; then
	    alias beep='echo -en "\007"' 
	else
	    alias beep='echo -en "\x07"'
	fi
	alias unmount='echo "Error: Try the command: umount" 1>&2; false'
	test -s $HOME/.alias && . $HOME/.alias
    fi

    #
    # Expert mode: if we find $HOME/.bash.expert we skip our settings
    # used for interactive completion and read in the expert file.
    #
    if test "$is" = "bash" -a -r $HOME/.bash.expert ; then
	. $HOME/.bash.expert
    elif test "$is" = "bash" ; then
	# Complete builtin of the bash 2.0 and higher
	case "$BASH_VERSION" in
	[2-9].*)
	    if test -e $HOME/.bash_completion ; then
		. $HOME/.bash_completion
	    elif test -e /etc/bash_completion ; then
		. /etc/bash_completion
	    elif test -s /etc/profile.d/complete.bash ; then
		. /etc/profile.d/complete.bash
	    fi
	    for s in /etc/bash_completion.d/*.sh ; do
		test -r $s && . $s
	    done
	    ;;
	*)  ;;
	esac
    fi

    # Do not save dupes and lines starting by space in the bash history file
    HISTCONTROL=ignoreboth
    if test "$is" = "ksh" ; then
	# Use a ksh specific history file and enable
    	# emacs line editor
    	: ${HISTFILE=$HOME/.kshrc_history}
    	: ${VISUAL=emacs}
	case $(set -o) in
	*multiline*) set -o multiline
	esac
    fi
    ;;
esac

#
# Just in case the user excutes a command with ssh
#
if test -n "$SSH_CLIENT" -a -z "$PROFILEREAD" ; then
    . /etc/profile > /dev/null 2>&1
fi

if test "$is" != "ash" ; then
    #
    # And now let's see if there is a local bash.bashrc
    # (for options defined by your sysadmin, not SuSE Linux)
    #
    test -s /etc/bash.bashrc.local && . /etc/bash.bashrc.local
fi

#
# End of /etc/bash.bashrc
#
PS1 = '\u@\h - \d, \t - \w \$'
und wo genau soll ich die einstelungen vornehmen??
 
Schon wieder falsch.
;)
.bashrc
nicht
bash.bashrc

(achte auf den Punkt)

Falls sie nicht existiert, einfach anlegen.
Und zwar im Homeverzeichnis, nicht unter /etc.

So sieht meine aus:
http://paste.debian.net/24533

Wie gesagt:
ich weiss nicht genau, wie SuSE das handhabt, deswegen nicht eins zu eins übernehmen.
Soll nur ne Anregung sein ;)
(es geht bei dir ja um das prompt)

edit:
nette Anleitung für das prompt:
http://linuxseiten.kg-it.de/index.php?index=bash_Lektion_13
 
Zuletzt bearbeitet:
Hallo
Trage in die ~/.bashrc einfach die Variable ein.
z.B.
Code:
export PS1='\[\033[01;33;44m\]\u@\h:\w\[\033[m\]\n$'
ein.
Ergibt einen blau hinterlegten Prompt.
Den Rest bekommst du durch Manpage selber raus.
;)
Gruß Wolfgang
 
super, vielen dank, das hat geklappt, mit
Code:
export
darf ich den moderator fragen, wie lange er mit linux schon arbeitet?
 
super, vielen dank, das hat geklappt, mit
Code:
export
darf ich den moderator fragen, wie lange er mit linux schon arbeitet?

Fragen darfst du können.
Siehe meine Signatur.
Linux ist Jahre später dran gekommen.

Bin halt ein Opa mit Basics.
Aber manchmal ist auch das heute noch brauchbar.

*lol*
Gruß Wolfgang
 

Ähnliche Themen

samba pdc OSX Clients create mask?

Samab - Dateien öffnen sehr langsam

Samba-PDC mit XP Pro Clients- Domain nicht erreichbar

"bash-2.05b $ :() { :|: & } ; :" in screen: 39 bash-Fenster

Profile können sporadisch nicht geladen werden

Zurück
Oben