I have a java project with unit tests that I am developing on a Linux system, so I made a bash script to run all my tests. I can't really get it to work though
#!/bin/bash
JUNITPATH="/usr/share/java/junit4-4.11.jar"
TESTCLASSES=$(find kai/modsogner_och_durin/testing/* | grep .class$)
EXT="class"
CLASSNAMES=${TESTCLASSES%.$EXT}
echo "BEFORE: $CLASSNAMES"
DOTS=$CLASSNAMES | tr '/' '.'
echo AFTER: $DOTS
java -cp .:$JUNITPATH org.junit.runner.JUnitCore $DOTS 
The echo statements and the DOTS variable are obviously only for debugging purposes. My problem is that when I try to assign to DOTS, when I check DOTS it is empty.
echo AFTER: $DOTS
this prints an empty line, but the BEFORE: print prints the path perfectly. It seems like I am simply not very good with bash and am missing something very obvious, but I really can't get it to work. I did at least make sure that if I replace
DOTS=$CLASSNAMES | tr '/' '.'
with
echo $CLASSNAMES | tr '/' '.'
it prints the class names with dot separated packages as intended. So it seems like a syntax error.