3

I've searched and found several answers but I didn't succeed in altering mine.

Operating system : Mac OS X

My .bashrc content

# Before other PATHs...
PATH=${PATH}:/usr/local/share/python

alias la='ls -la'

function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec  grep -l $2 {} \;}

#export -f find_cpp_filepath_with_string

else
    echo "WARNING: Can't find virtualenvwrapper.sh"
fi

The troublesome line is the following

function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec  grep -l $2 {} \;}

after trying source ~/.bashrc the result is :

line 21: syntax error: unexpected end of file
serj
  • 508
  • 4
  • 20

1 Answers1

4

You're correct when you say that the troublesome line is the following. You are missing a semicolon. Say:

function find_cpp_filepath_with_string { find $1 -name "*.cpp" -type f -exec grep -l $2 {} \; ; }

                ^
                |-----  You need to add a semicolon here!

The first semicolon is required to denote the end of -exec for the find command. The second one is required following the command group.

devnull
  • 118,548
  • 33
  • 236
  • 227