I'm new to it. x can not be recognized from above statement. What is the problem?
x = find . -name "*.java" | wc -l
echo $x
It should be
x=$(find . -name "*.java" | wc -l)
(Note that there is no space around the = sign)
To answer your question, the problem is
the space after x causes the shell to try to execute the command x which probably does not exist
you want the result of the command to be stored in x, so you need to execute the command (hence the $(...))
=.This should also work:
x=`find . -name "*.java" | wc -l`