Two tips for using Shell

Source: Internet
Author: User

In Linux, Shell refers to the Shell program that explains commands. It is very convenient to use Linu to compile programs with Shell skills. Here I will introduce two tips to use C Shell as an example ):

1. repeat a statement)

The traditional format is repeat num command.

Num indicates the number of cycles, and command indicates the command to be executed. However, we can use a method to fool C Shell so that the repeat command can execute complicated commands. We can write the complex command to be executed into a file, set the executable bit for the file, and execute the file repeatedly in the repeat loop body;

2. When the redirection character "> &" is used, although the standard error can be written to the file, this will make the standard output and the standard error mixed together, which is not easy to distinguish. Use:

(Yourcommand> & stdout. file)> & stderr. file

The standard output can be written to the stdout. file, and the standard error is written to the stderr. file, thus implementing the separation of the two.


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.