Shell script debugging

Source: Internet
Author: User
Tags mysql commands

The shell script was called for half an afternoon .. Shell is really a Nb tool .. Thanks for a space. If you do not enter one space, the space can be adjusted to death ..

1. There are some very strange errors. The error location during execution is not necessarily correct. In the afternoon, when the variable is initially defined, the last time I wrote less ", when the result is executed, the syntax error near unexpected token '(', which can be found through-x debugging.

2. Echo "some thing"> $ File

When the redirection symbol> is used to locate the output stream to the file, it is automatically created if the file does not exist. But !!! The premise of automatic creation is that the directory where the file is located already exists. You can only manually create the file by mkdir.

3,

Date_format = $ (echo $ SelectDate | SED's/-// G ')

This statement causes:

++ Echo 2013-08-09
++ Sed S/-// G
+ Date_format = 20130809
* *****. Sh: line 65: date_format: Command not found

Because there is a space between the equal sign and the left .. It's a tragedy .. Use date_format as a command

Do not have spaces on both sides of the equal sign.

4. When using MySQL commands

-Add the double quotation mark "" to the statement after the E Parameter

Related Article

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.