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 开发者_StackOverflowargs 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
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}
If your file path is store in lstf variable, just called it
javac "$lstf"
精彩评论