4 ms·
Please write a makefile that uses an environment variable as a mysql password to connect to a mysql server and perform an arbitrary administrative task. Now do
by gonvaled 9y ago
Please write a makefile that uses an environment variable as a mysql password to connect to a mysql server and perform an arbitrary administrative task.
Now do the same, assuming that the password can have a dollar in it.
You can do it. It is not as easy, readable or maintanable. Avoid it if you can.
- ibotty 9y agoNot a problem if you use a my.cnf file...
- gonvaled 9y agoAnd I need that because of ... a dollar! Extra complication to avoid if possible.
- flukus 9y agoWhy do it from a makefile instead of a script called by the makefile? This plays well to the strengths of both.
- gonvaled 9y agoJust because of the dollar? Exactly my point.
- flukus 9y agoNo, not just because of the dollar. Because it's easier to test in isolation and allows you to use things like here docs which are useful for dealing with sql.
- gonvaled 9y ago? Somehow we started with a single dollar in a string, and now I am dealing with sql, here docs, and TDD? There is a place for everything in life: for small helper makefiles, which I write simply to support me in my workflow and even to remember some interesting commands that I need to run for a certain project, I can assure you that making some simple assumptions helps me staying halfway sane.
- rcxdude 9y agoThis represents a problem with make, not any other part of the system.