[SOLVED] source bashrc -> syntax error: unexpected end of file
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
source bashrc -> syntax error: unexpected end of file
I don't remember making any changes on any of these files on my account:
.bashrc
.bash_profile
.bash_logout
However, when I log into my slack box through ssh from another place, I get this error message:
Quote:
-bash /home/xri/.bashrc syntax error: unexpected end of file
-bash /home/xri/.bash_profile syntax error: unexpected end of file
Once inside my slackbox, after source <.bashrc | .bash_profile | .bash_logout>, I get the same error message, with all of them.
I checked them all, inside vim, which highlights the code, and I did not find anything unusual.
This is puzzling. I don't know what to look at.Could somebody give me a hint?
# ~/.bashrc
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source system-wide aliases and functions
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
# --- Local/Personal environment variables ---
# define bash prompts, non-X text editors, etc.
unset MAILCHECK
# --- Local aliases ---
# Listing and cd
alias ll='ls -lh --color|most'
alias la='ls -lah --color|most'
alias lt='ls -ltrh --color|most'
alias ls='ls --color'
alias l='ls -l --color'
alias d='pwd'
alias dow='cd /home/xri/downloads'
alias co='cd /home/xri/const'
alias pr='cd /home/xri/newsoftware'
alias is='cd /home/xri/isos'
alias fl='cd /home/xri/.fluxbox'
alias ..='cd ..'
alias cl='clear'
# Locally
alias find='find . -iname'
alias ft='find . -ctime'
alias me='echo 'rig' && uname -n && echo 'ME' && whoami && echo 'LOCATION' && pwd '
alias pgrep='pgrep -l'
# On the net
alias lya='lynx wiki.archlinux.org'
alias lyn='lynx www.linuxquestions.org'
alias g='google -search=linux'
alias wk='wikipedia'
# This system
alias mo='mount|grep -v logi|grep -v tmp|grep -v usb|grep -v fuse'
alias ml='mount|grep logi'
alias mf='mount|grep fuse'
alias df='df -h'
alias ram='free -m'
# This file
alias cm='vim ~/.bashrc'
alias cmm='source ~/.bashrc'
#################################################
# --- Local functions ---
#################################################
# Necessary for now
if [ -f /home/xri/personal/somedata.kdb.lock ]; then
rm /home/xri/personal/somedata.kdb.lock
fi
##################################################
# More important actions
alias m='msgc'
alias n='notesshort'
alias cla='sgc-claws'
alias comp='src2pkg'
##################################################
# Activated at startup
Quote:
# ~/.bash_profile
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source Local/Personal aliases and functions
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi
# Source /usr/local/bin/bash_login
if [ -x /usr/local/bin/bash_login ]; then
/usr/local/bin/bash_login
fi
# --- Local/Personal startup programs ---
Quote:
# ~/.bash_logout
#
# see /etc/bashrc for a complete description how all bash source files
# are related and used on this box
# Source /usr/local/bin/bash_logout
if [ -x /usr/local/bin/bash_logout ]; then
/usr/local/bin/bash_logout
fi
rm /home/ele/algo/trivialidades.kdb.lock
I haven't edited any of them recently, let alone all three of them.
However, out of a sudden, I'm getting these error messages:
Quote:
bash-4.1$ source .bashrc
bash: ./.bashrc: line 73: syntax error: unexpected end of file
bash-4.1$ source .bash_profile
bash: ./.bash_profile: line 16: syntax error: unexpected end of file
bash-4.1$ source .bash_logout
bash: ./.bash_logout: line 13: syntax error: unexpected end of file
Is this all on one line?:
alias me='echo 'rig' && uname -n && echo 'ME' && whoami && echo 'LOCATION' && pwd'
If not, try making it so. Another thing you might try is having a an empty newline at the end of each file -have you upgraded bash recently?
Does that line that gnashley noted actually work? You're using a single quote to denote the contents of the alias but using the same single quote within the alias definition...I would think it would be breaking in and out of the alias definition.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Well I just tried temporarily replacing my bashrc and bash_profile with the ones you posted and they work fine ( except any missing programs/folders/files that you may have installed that I don't ) maybe the files themselves have been corupted, I just tried changing the line ends to dos type via the todos command and now get the same errors as you are getting so I guess thats a good place to start.
Does that line that gnashley noted actually work? You're using a single quote to denote the contents of the alias but using the same single quote within the alias definition...I would think it would be breaking in and out of the alias definition.
Yes, it appears to (but the inner quotes are all stripped from the alias:
Code:
bash-4.1$ alias me='echo 'rig' && uname -n && echo 'ME' && whoami && echo 'LOCATION' && pwd'
bash-4.1$ alias
alias me='echo rig && uname -n && echo ME && whoami && echo LOCATION && pwd'
bash-4.1$ me
rig
darkstar
ME
james
LOCATION
/home/james
bash-4.1$
He's sourcing /etc/bashrc in his first two scripts, but on my machine:
Code:
bash-4.1$ cat /etc/bashrc
cat: /etc/bashrc: No such file or directory
bash-4.1$
But I bet that Keith Hedger (above) is onto something with the line endings.
Is this all on one line?:
alias me='echo 'rig' && uname -n && echo 'ME' && whoami && echo 'LOCATION' && pwd'
If not, try making it so. Another thing you might try is having a an empty newline at the end of each file -have you upgraded bash recently?
Thanks for the input, all of you.
The line actually works as it is (I always use it, and I'm using it right now).
I have not upgraded bash recently. It's all original slack, with some slackbuilds on top of it.
I have not touched the files in question with any DOS or Windows tool at all. However, I'm very interested in following on Keith Hedger's idea, although I don't know how to do that at this point.
By the way, I'm uploading a snapshot of all my installed programs, and when they were installed. Sorry, I could not paste the content here ('too many characters').
You could try progressively commenting out lines in the hope of identifying the problem line(s). .bash_logout, being the shortest would be a good one to start with.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.