The abstract of (chapter01 to chapter03)

Source: Internet
Author: User
Tags builtin control characters

Chapter 1. Why shell programming?
The chapter answer why you need to grasp shell programming and answer when not to use shell scripts.

--------------------------------------------------------------
Chapter 2. Starting off with a sha-bang
Start a file with #! /XXX/xxx and make it executable.
#! /Bin/sh
#! /Bin/bash
#! /Usr/bin/perl
#! /Usr/bin/TCL
#! /Bin/sed-F
#! /Usr/awk-F

2.1. Invoking the script
1 make the script executable.
Chmod 555 scriptname
Chmod + RX scriptname
Chmod U + RX scriptname
2 execute the shell script
./Criptname arguments

---------------------------------------------------------------
Chapter 3. Exit and exit status
1 $? Reads the exit status of the Last Command executed. $? Is especially useful for testing the result of a command in a script.
Caution:
Certain exit status codes have reverved meanings and shoshould not be user-specified in a script.

__________________________________________________________________
Chapter 4. special characters
1 Comments :#
Eg: # This line is a comment.
But the first Hash (#) In the next statement is not a comment.
Echo $ {path # * :}# parameter substitution, not a comment.
Caution:
Certain pattern matching operations also use #.
2 command separator :;
Eg: Echo hello; echo there
3 terminator in a case option:; [double semicolon]
Eg: Case "$ variable" in
ABC) echo "$ variable = ABC ";;
XYZ) echo "$ variable = xyz ";;
Esac
3 dot command :.
1st: A dot is equivalent to source. This is a bash builtin.
2nd: In a regular expression, a dot matches a single character.
3rd: A dot is the filename prefilx of a "hidden" file, a file that an ls will not normally show.
4 patial quoting: "[double quote]
5 full quoting: '[single quote]
6 comma OPERATOR :,
7 ESCAP:/x
8 Filename Path separator :/
9 command substitution :'
10 NULL command ::
11 reverse (or negate) the sense of a test or exit status :!
12 wild card :*
13 wild card (single character ):?
14 variable substitution: $
Caution:
In a regular expression, a $ matches the end of a line.
15 parameter substitution :$ {}
16 positional parameters: $ *, $ @
17 Command Group :()
Eg: (A = Hello; echo $)
18 brace expansion :{}
Eg: grep Linux File *. {txt, HTM *}
# In the files "filea.txt", "file2.txt", "filer.html", "file-87.htm", etc.
18: block of code :{}
Eg: Bash $ {local A; A = 123}
19 test: []
Test expression between []. Note that [is part of the shell builtin test, not a link to the external command/usr/bin/test.
20 test: [[]
Test expression between [[] (shell keyword ).
21 integer expansion :(())
Expand and evaluate integer expression (()).
22 redirection: >>>>> <
23 pipe: |
24 Force redirection:> 1
25 run job in Background :&
26 redirection from/to stdin or stdout:-[dash]
27 previous working directory:-[dash]
28 minus :-
29 equals: =
30 plus: +
31 modulo: %
32 Home Directory :~
33 current working directory :~ +
34 previous working directory :~ -
35 control characters
CTL-C: terminate a foreground job.
CTL-D: log out from a shell (simial to exit or EOF)
Ctl-6: "BEL" (beep)
CTL-H: backspace
CTL-J: Carriage Return
CTL-M: newline
CTL-u: erase a line of input
CTL-Z: Pause a foreground
36 whitespace: functions as a separator, separating command or variables.
Note: $ ifs, the special variable separating fields of input to certain commands, defaults to whitespace.

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.