Create tables in batches using shell scripts

Source: Internet
Author: User

Shell script batch table creation 1. I often use shell scripts to batch create tables, count .... while do [SQL stat] done and so on, when create table select * from xxxx where 1 = 2, have you been attacked by the primary key index of primary key auto_increment that your id has not automatically created. 2. Have you ever written function (){...} I have received parameters in the function. Have you ever written $ data = "xxx"? But in the result, you want your function to receive a parameter, but you passed the parameter fun $ data =_^. Haha, in fact, the effect is like this. fun xxx, Haha, I just tried it. So, you should write fun "$ data" 3. for file in 'ls | grep ^ this '. You must have used it. Do you want to cd it to a directory before this command, so, when you echo $ file, will it bring the directory information? Are you sure you want to say that? I got stuck. This is my code. [Plain] function load_game_data2_dbs () {file = $1 echo_log "$ file is importing the Database" <span style = "font-family: Arial, Helvetica, sans-serif; "> ..... </Span> <span style = "font-family: Arial, Helvetica, sans-serif; ">}</span> [plain] for file in 'ls | grep ^ attemp 'do echo_log" has entered the final loop, prepare to export the package "# distribute the file to the raw data on the four databases, on behalf of the auto table load_game_data2_dbs "$ Directory/$ file" echo_log ", the data $ Directory/$ file has been imported into four databases, prepare the file to complete the initial state \ n "# import the package completion mark position on the four databases to the initial state <span style =" font-family: Arial, Helvetica, sans-serif; "> ...... </Span> <span style = "font-family: Arial, Helvetica, sans-serif;"> done </span> in [plain] load_game_data2_dbs, I printed <span style = "font-family: Arial, Helvetica, sans-serif;"> $ Directory/$ file. Then, echo_log also prints </span> <span style = "font-family: Arial, Helvetica, sans-serif;"> $ Directory/$ file, what are the two outputs? I got pitted, but later I learned how to get pitted. In the load_game_data2_dbs function, you need to add the loacl keyword to the file variable. This is completely different from other languages you have learned. </Span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.