Cat a file into a BASH variable

Viewed 23

I am writing a BASH script that reads in java files. I was attempting to cat a java file into a BASH variable by doing the following:

MY_VARIABLE=$( cat myJavaFile.java ) or any number of other BASH commands to set the BASH variable.

The problem comes when I have the following line in the java file:

/***************** or /**

Seems like any line that starts with the first character being '/' what I get in my BASH variable is a ls of the root directory and that line containing the '/' is not in the variable. All other lines are present in the BASH variable from the file. If I add a character in front of a line containing '/' as the first character I get the line.

Can someone explain what I am doing incorrectly or not understanding?

Thanks in advance.

0 Answers
Related