Bug #20184 | Patch to add #!/path/mysql shebang capability to cmdline client | ||
---|---|---|---|
Submitted: | 1 Jun 2006 2:03 | Modified: | 30 Nov 2009 14:42 |
Reporter: | Arjen Lentz | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S4 (Feature request) |
Version: | any | OS: | Any (any) |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution |
[1 Jun 2006 2:03]
Arjen Lentz
[1 Jun 2006 2:07]
Arjen Lentz
Username/pwd and other options can be handled via the ~/.my.cnf, of course.
[22 Jun 2006 14:13]
Sergei Golubchik
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at http://www.mysql.com/downloads/ Additional info: It's already supported. Use #!/usr/bin/mysql -e source -e
[22 Jun 2006 22:45]
Arjen Lentz
Sergei, please specify which versions exactly this was introduced, then pass on to Docs? I'm afraid your earlier response, which is a mix of "already been fixed in latest released version" and "already supported, is confusing and will not actually help users. Thanks.
[22 Jun 2006 23:03]
Beat Vontobel
It also seems to me, that the behaviour of the command line client differs for files read via input redirection opposed to the "source" command, for example for some of the commands interpreted by the client (e.g. delimiter). (I'll check this out in detail and will maybe make a separate bug report out of that.) So I'd really prefer Arien's patch to the "-e source -e" trick, even if it's a nice one (or at least it should be documented, that would've saved me from some hassle - or is it documented somewhere?). And it's not really intuitive anyway. Just not what you're used to from most of the other UNIX command line tools. But thanks anyway, I'm happy to see that it's possible to do!
[26 Jul 2006 14:45]
Magnus BlÄudd
The functionality to use several -e on the command line has been there since revision 1.121.1.43 committed 2004-05-05
[26 Jul 2006 16:21]
Arjen Lentz
It may be "in there" but that's the wrong way round. People (like Beat) are specifically looking for a way to use shebang. So, I think this should be in the manual from that angle, and get an indexterm also. Hence the previous status "need doc info"... I've now assigned it to the Docs team so it may deal with it. Thanks.
[31 Jul 2006 20:19]
Paul DuBois
The mysql -e source -e trick cannot be relied on (it fails on Gentoo Linux, for example), so it's not something we should suggest in the manual. Moving this back to Open status.
[10 Dec 2006 23:01]
Arjen Lentz
Seeing that apparently -e source -e is not reliable (and it's ugly anyway), we're back to square one where I submitted the patch. So can we reconsider this contribution and help our users?
[19 Apr 2018 19:32]
Andres Gomez
There is a SQL syntax supported by Db2 and Postgres for the shebang. It does not neet #! at the beginning and the result is the same: In Db2 --() { :; }; exec db2 -tf "$0" In Postgres --() { :; }; exec psql -f "$0" References: http://angocadb2.blogspot.com.co/2018/04/how-to-make-db2-scripts-executable.html http://rosettacode.org/wiki/Multiline_shebang#PostgreSQL