You are not logged in.

#1 2011-04-29 12:26:39

unilx
Member
From: Fredericton,Canada
Registered: 2009-10-01
Posts: 183

bash.bashrc errors

I merged my bash.bashrc and bash.bashrc.pacnew and now I'm getting errors everytime i open a terminal.I'm not sure what i changed or how to fix it.Is there anyway to replace my bash.bashrc for a default copy?

Here is my bash.bashrc

  1 --- bash.bashrc
  2 +++ bash.bashrc.pacnew
  3 @@ -1,32 +1,24 @@
  4  #
  5  # /etc/bash.bashrc
  6  #
  7 -# This file is the systemwide bashrc file. While most of the
  8 -# environment is preserved when running an interactive shell
  9 -# the PS[1-4] variables, aliases and functions are reset.
 10 -#
 11 -# When running a non-login shell, apply the following settings:
 12 -# - Prompt defaults (PS[1-4], PROMPT_COMMAND)
 13 -# - bash_completion if it exists
 14 -# - source /etc/bash.bashrc.local
 15 +
 16 +# If not running interactively, don't do anything
 17 +[[ $- != *i* ]] && return
 18  
 19  PS1='[\u@\h \W]\$ '
 20  PS2='> '
 21  PS3='> '
 22  PS4='+ '
 23  
 24 -export PS1 PS2 PS3 PS4
 25 -
 26 -if test "$TERM" = "xterm" -o \
 27 -        "$TERM" = "xterm-color" -o \
 28 -        "$TERM" = "xterm-256color" -o \
 29 -        "$TERM" = "rxvt" -o \
 30 -        "$TERM" = "rxvt-unicode" -o \
 31 -        "$TERM" = "xterm-xfree86"; then
 32 -    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
 33 -    export PROMPT_COMMAND
 34 -fi
 35 +case ${TERM} in
 36 +  xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
 37 +    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
 38 +                                                        
 39 +    ;;
 40 +  screen)
 41 +    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
 42 +    ;;
 43 +esac
 44  
 45  [ -r /etc/bash_completion   ] && . /etc/bash_completion
 46 -[ -r /etc/bash.bashrc.local ] && . /etc/bash.bashrc.local

Last edited by unilx (2011-04-29 12:27:48)

Offline

#2 2011-04-29 12:35:11

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: bash.bashrc errors

Post the error message.

Offline

#3 2011-04-29 12:39:56

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: bash.bashrc errors

Did you merge by copying the diff verbatim? That's what it looks like you did.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#4 2011-04-29 12:42:19

unilx
Member
From: Fredericton,Canada
Registered: 2009-10-01
Posts: 183

Re: bash.bashrc errors

Here's the first error

bash: ---: command not found
bash: +++: command not found
bash: @@: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: /etc/bash.bashrc: line 12: syntax error near unexpected token `('
bash: /etc/bash.bashrc: line 12: `-# - Prompt defaults (PS[1-4], PROMPT_COMMAND)'
[unilx@online ~]$ 

I tried commenting out line 12 and ran into another error

bash: ---: command not found
bash: +++: command not found
bash: @@: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: -#: command not found
bash: +: command not found
bash: /etc/bash.bashrc: line 41: unexpected EOF while looking for matching `''
bash: /etc/bash.bashrc: line 48: syntax error: unexpected end of file
[unilx@online etc]$ 

Also is there any good tutorials on using bashrc


edit: I used meld and patched the two files together

Last edited by unilx (2011-04-29 12:45:42)

Offline

#5 2011-04-29 12:45:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: bash.bashrc errors

0. Remove the first 3 lines.
1. Remove all the lines that start with '-'.
2. Remove the '+' from the beginnings of the lines.
3. Source bash.bashrc again.

You should pay more attention when dealing with .pacnew files.


Edit wrt to your edit: the file you have is just the diff, you need to apply it to your old bash.bashrc file.

Last edited by karol (2011-04-29 12:49:47)

Offline

#6 2011-04-29 12:46:56

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: bash.bashrc errors

Ok, here's what happened. DIff shows changes and has notations to describe the changes. You're supposed to only copy the changes you want. You copied the notation as well. Now you have some kind of hybrid diff/bashrc file which neither program would understand. My suggestion, start by learning how diff output is structured. Once you know that, fixing this will be easy.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#7 2011-04-29 12:48:48

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: bash.bashrc errors

ehh.... that means '---'  '+++'  '@@' etc are actually in your bash.bashrc - which is completely wrong. Look at the pacnew version, it doesn't have any of those.

Rename the pacnew to bash.bashrc, and then reinstate any changes you had made previously (if you want to keep them).

I'd strongly recommend you leave bash.bashrc alone, and put your custom configuration in ~/.bashrc instead.

Offline

#8 2011-04-29 13:05:16

unilx
Member
From: Fredericton,Canada
Registered: 2009-10-01
Posts: 183

Re: bash.bashrc errors

I had 10 other pacnew files but they were all straight forward and easily edited, but when i got to the bashrc it was a little confusing, that should have been my first sign to stay away.Anyway thanks for the help.No more errors.

Offline

Board footer

Powered by FluxBB