how to troubleshoot .bashrc errors
I just came across two errors in my .bashrc file after I saved the file and rebooted Ubuntu 12.04. The errors were associated with Lines 141 and 146. When I used gedit to examine the error area, I could go only as far as Line 140. I do not recall having edited this area. The indicated hints are terribly vague. I'll appreciate anyone's help.
Julianloui
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Ubuntu gedit Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- N1ck 7h0m4d4k15
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
what is the output of:
cat -n ~/.bashrc; cat /etc/issue
Thanks
Revision history for this message
|
#2 |
Andrew,
Thanks for your quick help. Listed below are the ouputs.
Julianloui
(1) cat /etc/issue
Ubuntu 12.04.2 LTS \n \l
(2) cat -n ~/.bashrc'
1 # ~/.bashrc: executed by bash(1) for non-login shells.
2 # see /usr/share/
3 # for examples
4
5 # If not running interactively, don't do anything
6 [ -z "$PS1" ] && return
7
8 # don't put duplicate lines or lines starting with space in the history.
9 # See bash(1) for more options
10 HISTCONTROL=
11
12 # append to the history file, don't overwrite it
13 shopt -s histappend
14
15 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
16 HISTSIZE=1000
17 HISTFILESIZE=2000
18
19 # check the window size after each command and, if necessary,
20 # update the values of LINES and COLUMNS.
21 shopt -s checkwinsize
22
23 # If set, the pattern "**" used in a pathname expansion context will
24 # match all files and zero or more directories and subdirectories.
25 #shopt -s globstar
26
27 # make less more friendly for non-text input files, see lesspipe(1)
28 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
29
30 # set variable identifying the chroot you work in (used in the prompt below)
31 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
32 debian_chroot=$(cat /etc/debian_chroot)
33 fi
34
35 # set a fancy prompt (non-color, unless we know we "want" color)
36 case "$TERM" in
37 xterm-color) color_prompt=yes;;
38 esac
39
40 # uncomment for a colored prompt, if the terminal has the capability; turned
41 # off by default to not distract the user: the focus in a terminal window
42 # should be on the output of commands, not on the prompt
43 #force_
44
45 if [ -n "$force_
46 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
47 # We have color support; assume it's compliant with Ecma-48
48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
49 # a case would tend to support setf rather than setaf.)
50 color_prompt=yes
51 else
52 color_prompt=
53 fi
54 fi
55
56 if [ "$color_prompt" = yes ]; then
57 PS1='${
58 else
59 PS1='${
60 fi
61 unset color_prompt force_color_prompt
62
63 # If this is an xterm set the title to user@host:dir
64 case "$TERM" in
65 xterm*|rxvt*)
66 PS1="\[
67 ;;
68 *)
69 ;;
70 esac
71
72 # enable color support of ls and also add handy aliases
73 if [ -x /usr/bin/dircolors ]; then
74 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
75 alias ls='ls --color=auto'
76 #alias dir='dir --color=auto'
77 #alias vdir='vdir --color=auto'
78
79 alias grep='grep --color=auto'
80 alias fgrep='fgrep --color=auto'
81 alias egrep='egrep --color=auto'
82 fi
83 x
84 # some more ls aliases
85 alias ll='ls -alF'
86 alias la='ls -A'
87 alias l='ls -CF'
88
89 # # MY OWN ALIASES
90 alias juno='firefox www.juno.com'
91 alias goog='firefox www.google.com'
92 alias vbgov='firefox www.vbgov.com'
93 alias veriz='firefox www.verizon.net'
94 alias csmon='firefox www.csmonitor.com'
95 alias verz='firefox www.verizon.net'
96 alias lib='firefox http://
97 alias julianvb='firefox http://
98 alias yahoo='firefox www.yahoo.com'
99 alias twuug='firefox www.twuug.org'
100 alias lpad='firefox www.launchpad.net'
101 alias launchpad='firefox www.launchpad.net'
102 alias sourceforge=
103 alias sforge='firefox www.source.net'
104 alias inks='firefox www.houseofinks
105 alias amazon='firefox www.amazon.com'
106 alias craigs='firefox norfolk.
107 alias ebay='firefox www.virginiabea
108 alias apins='sudo apt-get install'
109 alias shutnow='sudo poweroff now'
110 alias 192168='firefox http://
111 alias 1ax='firefox www.oneacross.com'
112 alias sentara='firefox www.sentara.com'
113 alias fidel='firefox https:/
114 alias tda='firefox https:/
115 alias rsource='firefox https:/
116 alias humana='firefox http://
117 alias cap1='firefox https:/
118 alias boa='firefox https:/
119 alias tbird='thunderbird'
120 alias puppy='firefox www.puppylinux.com'
121 alias browlnx='firefox www.browserlinu
122 alias browserlnx='firefox www.browserlinu
123 alias uneboot='firefox http://
124 # # END of MY OWN ALIASES
125
126 # Add an "alert" alias for long running commands. Use like so:
127 # sleep 10; alert
128 alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^
129
130 # Alias definitions.
131 # You may want to put all your additions into a separate file like
132 # ~/.bash_aliases, instead of adding them here directly.
133 # See /usr/share/
134
135 if [ -f ~/.bash_aliases ]; then
136 . ~/.bash_aliases
137 fi
138
139 # enable programmable completion features (you don't need to enable
140 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
141 # sources /etc/bash.bashrc).
142 if [ -f /etc/bash_
143 . /etc/bash_
144 fi
Revision history for this message
|
#3 |
looks ok. what is the output of:
source ~/.bashrc
Thanks
Revision history for this message
|
#4 |
Andrew:
This is the error output message.
x: command not found
bash: /home/ju/.bashrc: line 140: unexpected EOF while looking for matching `''
bash: /home/ju/.bashrc: line 145: syntax error: unexpected end of file
Julianloui
Revision history for this message
|
#5 |
Here is the ORIGINAL .bashrc of UBUNTU
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_
if [ -n "$force_
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1=
else
PS1=
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1=
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_
. /etc/bash_
fi
I would suggest to move all of your aliases in a file named .bash_aliases , it works better .
Then to replace the current .bashrc file with the original above issue the following command
wget "http://
above command will replace the current .bashrc with the new listed above (the original) so FIRST move YOUR ALIASES to .bash_aliases file or you will LOSE THEM.
If the file .bash_aliases does not exist, you can create it.
Regards
NikTh
Revision history for this message
|
#6 |
Nick,
Your instructions worked out perfectly. Now I've a working simple .bash_aliases file as well as the original untouched .bashrc file.
I even alphabetized the entries in the above personal alias file for easy future editing.
Many thanks to you and Andrew.
Julianloui
Revision history for this message
|
#7 |
Thanks Nik.Th., that solved my question.