Bashrc Line Syntax Error Unexpected End Of File
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta
Syntax Error Unexpected End Of File Php
Discuss the workings and policies of this site About Us Learn syntax error unexpected end of file bash more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us syntax error unexpected end of file wordpress Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you,
Syntax Error Unexpected End Of File Bash Script
helping each other. Join them; it only takes a minute: Sign up .bashrc syntax error: unexpected end of file up vote 1 down vote favorite 1 I am getting an unexpected end of file error. I am not really sure how to fix it. # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
Syntax Error Unexpected End Of File Shell Script
# User specific aliases and functions export PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]' export LS_COLORS='di=35;1' alias la='ls -lah' alias cdu='cd /home/hzhang/primary' #module load gnu-compilers/4.7.0 #module load mvapich3/gnu/1.7 .ls /opt/intel/Compiler/11.1/072/bin/ifortvars.sh intel64 #PATH=$PATH:/home/hzhang/primary/over2.2e/bin_dp:/home/hzhang/primary/foiltest PATH=$PATH:/opt/overflow/intel/serial/bin_dp/:/home/hzhang/primary/chimera2.1/bin_dp/:/u/primary/hzhang/pegasus/bin_dp export PATH ulimit -s unlimited linux bash share|improve this question edited Aug 13 '12 at 7:17 Pavan Manjunath 14.6k55992 asked Aug 13 '12 at 7:16 derry30 3113 2 Nothing apparent in that file, though .ls looks odd. Check /etc/bashrc –geirha Aug 13 '12 at 7:42 1 ... and assuming the .ls is typo only here, in the question, check the .../ifortvars.sh too. And you might want to enclose $PATH in double quotes, in case a PATH element contains some special characters (like brackets). –fork0 Aug 13 '12 at 8:11 as @tooboring4me mentions check if all lines including the last end in \n –mnagel Aug 1 '13 at 12:36 // , .bashrc loads several other files, like .bash_aliases. Check here for an example of this error that was fixed by editing another file: stackoverflow.c
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies syntax error unexpected end of file python of this site About Us Learn more about Stack Overflow the company Business
Syntax Error Unexpected End Of File Unix
Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ syntax error unexpected end of file laravel Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody http://stackoverflow.com/questions/11929705/bashrc-syntax-error-unexpected-end-of-file can answer The best answers are voted up and rise to the top bash: /etc/bash.bashrc: line 122: syntax error: unexpected end of file up vote 0 down vote favorite # System-wide .bashrc file for interactive bash(1) shells. # To enable the settings / commands in this file for login shells as well, # this file has to be sourced in /etc/profile. # If not http://askubuntu.com/questions/739695/bash-etc-bash-bashrc-line-122-syntax-error-unexpected-end-of-file running interactively, don't do anything if [ -z "$PS1" ] && return # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' use_color=true # Set colorful PS1 only on colorful terminals. # dircolors --print-database uses its own built-in database # instead of using /etc/DIR_COLORS. Try to use the external file # first to take advantage of user additions. Use internal bash # globbing instead of external grep binary. safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM match_lhs="" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true if ${use_color} ; then # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then # test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || ev
#1 2013-08-27 22:56:14 MoonSwan Member From: Great White North Registered: 2008-01-23 Posts: 873 [Solved] Sourcing .bashrc gets "syntax error: unexpected end of file" I've looked at the wiki and the https://bbs.archlinux.org/viewtopic.php?id=168953 web as well as this forum for a clue as to why my .bashrc file spits out "syntax error: unexpected end of file." On boot-up my user account gives me this http://superuser.com/questions/237684/bashrc-reports-unexpected-eof error when I login to a TTY or open a terminal window. As a result, my nice prompt that I spent some time developing doesn't work and my prompt instead syntax error defaults to a prompt I put into /etc/bash.bashrc just for fun. That prompt gives you a smiley face if your last command worked or a frowny face if it failed. Should anyone wish to use it, here it is: PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \") syntax error unexpected \\$\[\033[00m\] " I am posting the original .bashrc file and one stripped of all extraneous material in the hope that my mistake is more easily found.My stripped down .bashrc I've used to try to debug this issueif [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return ###Promts & Terminal theme is black on white ## name=dark purple; relative directory=medium purple; prompt=dark purple; font code=light grey PS1='\[\e[0;35m\]\u\[\e[m\]\[\e[0;37m\] \W\[\e[m\]\[\e[0;35m\] \$ \[\e[m\]\[\e[0;37m\]' ## erase duplicate entries in your history file ~HL June 2012 export HISTCONTROL=erasedups # TMUX if which tmux 2>&1 >/dev/null; then #if not inside a tmux session, and if no session is started, start a new session test -z "$TMUX" && (tmux attach || tmux new-session) fi ### ## sets the default editor to be nano export EDITOR="nano" ### ## You can enable code syntax coloring in less by installing "source-highlight" export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s" export LESS='-R ' ### man() { env LESS_TERMCAP_mb=$(printf "\e[1;32m") \ LESS_TERMCAP_md=$(printf "\e[0;32m") \ LESS_TERMCAP_me=$(printf "\e[0m") \ LESS_TERMCAP_se=$(printf "\e[0m") \ LESS_TERMCAP_so=$(printf "\e[4;30;0;31m") \ LESS_TERMCAP_ue=$(printf "\e[0m") \ LESS_TERMCAP_us=$(printf "\e[1;33m") \ man "$@" }The origin
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Super User Questions Tags Users Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top .bashrc reports unexpected EOF up vote 0 down vote favorite I am trying to add some functions to my bashrc, namely: h () { history | fgrep $1 | sort -u | cut -b 8- } extract () { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) rar e $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 ;; *.tbz2) tar xvjf $1 ;; *.tgz) tar xvzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "I don't know how to extract '$1'." ;; esac else echo "'$1' is not a valid file!" fi } using the following command: echo -e "\ h () { history | fgrep \044\061 | sort -u | cut -b 8- } extract () { if [ -f \044\061 ] ; then case \044\061 in *.tar.bz2) tar xvjf \044\061 ;; *.tar.gz) tar xvzf \044\061 ;; *.bz2) bunzip2 \044\061 ;; *.rar) rar e \044\061 ;; *.gz) gunzip \044\061 ;; *.tar) tar xvf \044\061 ;; *.tbz2) tar xvjf \044\061 ;; *.tgz) tar xvzf \044\061 ;; *.zip) unzip \044\061 ;; *.Z) uncompress \044\061 ;; *.7z) 7z x \044\061 ;; *) echo \042I don't know how to extract '\044\061'.\042 ;; esac else echo \042'\044\061' is not a valid file\041\042 fi }" >> ~/.bashrc ...but this results in bash: /home/chris/.bashrc: line 123: syntax error: unexpected end of file when bash starts up. If I remove these functions, this error goes away. Is there some closing statement I must add to the functions section? bash syntax share|improve this question edited Dec 26 '15 at 23:46 Hennes 50.7k775120 asked Jan 25 '11 at 16:56 Matthieu Cartier 3,1741334 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted The first line is the problem. h () { history | fgrep $1 | sort -u | cut -b 8- } Change it to this: h () { history | fgrep $1 | sort -u | cut -b 8- ; } Or: h () { history | fgrep $1 | sort -u | cut -b 8- } Also, an easier/cleaner way to get it into your .bashrc is with redirection (although you do still need to escap