BASH/PSQL whitespace issues
Go to solution
Solved by Eigenvektor,
5 minutes ago, CJPowell27 said:Interesting, so it basically doesn't concatenate properly by doing something like that? If what you are saying is the case, how do you recommend I get it to function as I intended?
From bash's point of view you are passing
--command "select * from cpu c inner join motherboard m on c.socket=m.socket where m.modelName="
as the argument for psql. As soon as bash encounters the second quote this argument is at an end. So anything that comes after that is treated as additional arguments.
So you need to write it as
--command "select * from cpu c inner join motherboard m on c.socket=m.socket where m.modelName='$var2' and c.modelname='$var1';"
For bash to treat that as a single argument.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now