I am rather new to programming, and completely new to BASH. As described in the title, I am trying to loop through the current directory and store the files ending with .cpp into an array. I also am trying to create a second array which replaces the ".cpp" suffix with ".o" Whenever I try to compile I get "syntax error in conditional statement"
x=0
cwd=$(pwd)
for i in $cwd; do
if [[ $i == *.cpp]]
then
cppfield[$x] = $i
ofield[$x] = field[$x] | sed s/.cpp/.o/
x=$((count+1))
fi
done