Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using CentOS 6.2. This is my ~/.bash_profile content:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc

# User specific environment and startup programs

export PATH

However, when I source it using

source .bash_profile

it returns

if: Expression Syntax.


This is my .bashrc file:

# .bashrc
# Source global definitions

if [ -f /etc/bashrc ]; then

        . /etc/bashrc


# User specific aliases and functions
share|improve this question
How does your ~/.bashrc look? Since it is sourced in .bash_profile, the error might be in there (and probably is). – Daniel Andersson Aug 9 '12 at 9:37
up vote 7 down vote accepted

Perhaps you accidentally ran this from csh?

$ csh
lucid32:~> source if_rc
if: Expression Syntax.
lucid32:~> cat if_rc
if [ -f /etc/bashrc ]; then
share|improve this answer
i changed shell to bash now it's working fine. thanx – max Aug 9 '12 at 10:23
How I did this: I had a hunch, having once used tcsh in the grey past. if: Expression Syntax. just did not look like anything that I know from any Bourne/POSIX shell or derivative. Google and a couple of lines of code did the rest. – Henk Langeveld Aug 9 '12 at 14:26
+1: Nice catch. – chepner Aug 9 '12 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.