Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I'm running CentOS 5.6 and am having trouble with gnome terminal. After changing the .bashrc file to display the prompt differently the terminal won't open. I undid my changes ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    3

    gnome terminal won't launch after changing .bashrc file


    Hello,

    I'm running CentOS 5.6 and am having trouble with gnome terminal. After changing the .bashrc file to display the prompt differently the terminal won't open. I undid my changes to .bashrc but am still having trouble. I can launch the terminal as root, and I can launch other programs in the terminal using Alt-F2. I've found some posts pointing at gconf but I don't know what settings I'm looking at there. Any help would be appreciated. Thanks,
    -Heber

  2. #2
    Linux User twoHats's Avatar
    Join Date
    Jan 2005
    Location
    NH, USA
    Posts
    280

    code?

    you might want to give us the text of the file you created and the one you are using now.

    If you break some files they will cause a login failure. .bashrc is one of these.

    A good idea is to actually copy any file you are going to edit (eg)
    Code:
    cp .bashrc .bashrc.original
    so that you can get the exact one back if a problem occurs with the edit.

    HTH
    - Clouds don't crash - Bertrand Meyer

    registered Linux user 393557

    finally - hw to brag about - but next year it will look pitifully quaint:
    Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
    circa 2006

  3. #3
    Just Joined!
    Join Date
    Jul 2010
    Posts
    3
    Here's my .bashrc file. The code I added is commented out at the bottom. The goal was to get the prompt to display in red text when I was root. That will still work if I log in as root.

    Code:
    # 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
    	}
    
    	# Only display echos from profile.d scripts if we are no login shell
        # and interactive - otherwise just process them to set envvars
        for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
                if [ "$PS1" ]; then
                    . $i
                else
                    . $i >/dev/null 2>&1
                fi
            fi
        done
    
    	unset i
    	unset pathmunge
    fi
    
    ## If id command returns zero, you’ve root access.
    #if [ $(id -u) -eq 0 ];
    #then # you are root, set red color prompt
    #PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]"
    #else # normal
    #  export PS1="[\\u@\\h:\\w] $"
    #fi
    
    
    # vim:ts=4:sw=4
    See anything out of place? I didn't think I was making big enough changes to warrant a backup file, but lesson learned there. I've also tried a couple supposedly "golden" .bashrc files from the internet and still have the same trouble, which makes me think I've mucked something else up without realizing it. Just for kicks I uninstalled and reinstalled gnome-terminal to see if that would help but with no luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •