List:General Discussion« Previous MessageNext Message »
From:Victor Pendleton Date:October 19 2004 12:42am
Subject:Re: Script question
View as plain text  
If you are on an *nix system you can try
\! echo Hello > test.txt

Rhino wrote:

>Sorry, you still haven't got it;-)
>
>I want the echo command to be in the *script*, not to be supplied at the
>command line. Is there some way to put a mix of MySQL commands and OS
>commands into a script and have both executed successfully via:
>
>mysql -u myid -pmypass < Load.sql > Load.out
>
>Rhino
>
>
>----- Original Message ----- 
>From: "Logan, David (SST - Adelaide)" <david.logan@stripped>
>To: "Rhino" <rhino1@stripped>; "mysql" <mysql@stripped>
>Sent: Monday, October 18, 2004 8:09 PM
>Subject: RE: Script question
>
>
>After re-reading your email in not so quite a rush 8-)
>
>Further to that, you can use the system command to run an OS command
>
>eg. system "echo thing";
>
>mysql> system echo "thing";
>thing
>mysql>
>
>
>
>Regards
>
>David Logan
>Database Administrator
>HP Managed Services
>148 Frome Street,
>Adelaide 5000
>Australia
>
>+61 8 8408 4273 - Work
>+61 417 268 665 - Mobile
>+61 8 8408 4259 - Fax
>
>
>
>________________________________
>
>From: Rhino [mailto:rhino1@stripped]
>Sent: Tuesday, 19 October 2004 9:13 AM
>To: mysql
>Subject: Script question
>
>
>
>Can anyone tell me how to make a script containing MySQL commands also
>execute an OS command?
>
>For instance, given this script, called Load.sql:
>
>--------------
>use SFL;
>
>#Load the data from the export file that was exported from Q&A as a
>standard
>#ASCII file.
>load data infile '/home/rhino/MySQL/SFL/FILMS.AS3'
>replace into table Dougs_Movies
>fields terminated by ';'
>optionally enclosed by '"'
>escaped by '\\'
>lines starting by '"'
>terminated by '\r\n';
>
>----------------
>
>I'd like to add some 'echo' statements to the script. However, when I
>include:
>
>echo "Hello"
>
>or
>
>!echo "Hello"
>
>I get a syntax error when I execute the script.
>
>I am executing the script from the Linux command line via this command:
>
>mysql -u myid -pmypass < Load.sql > Load.out
>
>It isn't strictly necessary to include 'echo' commands in the script as
>long as I can ensure that the text of my choice appears in the Load.out
>file in the place of my choosing, i.e. after the 'use' command has been
>executed but before the 'load' command has been executed.
>
>Can anyone help me this problem? I can't believe it is hard but I can't
>think what to search on in the archives.....
>
>Rhino
>---
>rhino1 AT sympatico DOT ca
>"There are two ways of constructing a software design. One way is to
>make it so simple that there are obviously no deficiencies. And the
>other way is to make it so complicated that there are no obvious
>deficiencies." - C.A.R. Hoare
>
>
>  
>

Thread
Script questionRhino19 Oct
RE: Script questionSST - Adelaide)19 Oct
RE: Script questionSST - Adelaide)19 Oct
  • Re: Script questionRhino19 Oct
    • Re: Script questionVictor Pendleton19 Oct
RE: Script questionSST - Adelaide)19 Oct
  • Re: Script questionRhino19 Oct
    • Re: Script questionBrian19 Oct
  • Re: Script questionRhino19 Oct
    • Re: Script questionBrian19 Oct
      • How to remove an indexleegold19 Oct
        • Re: How to remove an indexAman Raheja19 Oct
RE: Script questionCharles E Sweet19 Oct
  • Re: Script questionRhino19 Oct
  • Re: Script questionPhilippe Poelvoorde19 Oct
    • Re: Script questionGerald Taylor20 Oct
      • Re: Script questionSGreen20 Oct