Linux Shell sleep/wait (reprint)

Source: Internet
Author: User

Linux Shell sleep/wait (reprinted) 2007-04-27 18:12

Bash's basic configuration is made up of configuration files./etc/profile is called a global configuration file for the shell.
Another file in the personal directory under the personal directory/.bash-profile
There's a file in the personal directory./ETC/BASHRC is the second global profile, which holds (function aliases, etc.) also has a configuration file in the personal directory ~/.BASHRC
Environment variable: variable name = variable Value example: Lang=en is set language to English
LANG=ZH-CN.GB18030 is set language to Chinese
Value of reference variable: $ variable Name example: Export path= $PATH:/etc/xxx
For example: Echo $LANG echo echoing command to see the value of LANG
Example Export CMD =ls
$CMD –l equals Ls–l.
Output redirection: (1) name > filename The original command to output to the terminal is changed to output to a file
(This is called overlay redirection)
(2) Name >> file name
(add-on redirection)
Example: GCC command 0: standard input
1: Standard output
2: Standard error output

(3) Pipeline Unix traditional inter-process communication notation: Command 1 | Command 2
More or grep is often present at command 2.
Example: Cat/etc/services | grep ' http ' means an output that contains HTTP
Jinscan

Shell script: It is composed of shell commands, small-scale, structured, modular, program design. Command: Echo output information with
Read input information read variable name
Sleep sleeps sleep seconds
Arithmetic expression on Terminal: Echo $ ((1x2x3)) This is an integer operation with no decimal points.
/: Except
%: Remainder
Shell Script format:
The first line must be #!. /bin/sh
There are three structural sequential structure of the branching structure circular structure
Sequential structure
The wait command ensures that the process is waiting synchronously for a child process to end multiple concurrency with multiple wait
Example: #! /bin/sh
echo "1"
Sleep 5&
echo "3"
echo "4"
Wait
echo "5"
Branching structure

if judgment; Then
T block
Else
Block F
Fi
Judge Test statement Test expression = [expression]
The expression is file-determined-F file name (detects if the file exists and is a normal file
-D directory Name
-R Readable
-W Writable
-X Executable

These examples are due to years of disrepair (incomplete notes, forgotten places) Please forgive me for the error
Example:
            #! /bin/sh
           echo "file"
            read     FileName
            if     [-f $FileName]; Then
                echo "Yes"
             Else
             echo "No"
     fi

string comparison equal String a = string b
Unequal string A! = string B
-Z to determine if the string is zero null for true non-null false

Linux Shell sleep/wait (reprint)

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.