LanguagesNamedAfterCofee
LanguagesNamedAfterCofee

Reputation: 5952

Bash - argument not working

Hello I am running a javac command (lstf is a file)

javac @$lstf

For some reason, I get an error saying javac: file not found: path/to/dir/*.java. Whenever I type the args in manually in Terminal javac works.

Here is the code:

mkdir "$out"

cd src
scan

"$cc" $cflags -d "../$out" @${lstf}
rm -rf $lstf
cd ../

scan is the function that generates all the paths in the file $lstf - it works fine

Upvotes: 1

Views: 145

Answers (2)

David W.
David W.

Reputation: 107040

You need to say javac @foo, and lstf = foo?

Whenever you are in a situation where variable names are hard to decipher, you can use ${var} syntax instead of just $var:

javac @${lstf}

Upvotes: 1

bash-o-logist
bash-o-logist

Reputation: 6911

If your file path is store in lstf variable, just called it

javac "$lstf"

Upvotes: 0

Related Questions