MySQL: start SQL from shell script

The following code starts the SQL from the shell script directly, without additional SQL file

#!/bin/sh
--/. &> /dev/null; exec mysql "$@"

select 'Hello, world!' as test ;

The detailed explanation of the trick is here

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>