What I want to do it's to create an alias for the sentence below:
g++ -g -pedantic -Wall -o executablefilenamehere pathoffiletocompilehere
Because I have to compile single files frequently.
To do it, I'm trying creating a txt file with the output file name and the path of the file to compile. So I have a txt, called tocompile.txt, file that contains:
test /home/me/test.cpp
then, I assign to a var that I call tocompile the content of tocompile.txt:
tocompile=`cat tocompile.txt`
This is working, because if i do echo $tocompile I'm getting: test /home/me/test.cpp
So, then, I'm trying to create the alias doing:
alias gxxcomp='g++ -g -pedantic -Wall -o $tocompile'
It doesn't work, when I do:
gxxcomp
I get:
g++: error: missing filename after ‘-o’
g++: fatal error: no input files
compilation terminated.
What's the right way to do that?