2013年(24)
分类: LINUX
2013-04-04 21:54:53
# |
Comments(a quoted or an escaped # in an echo statement does not begin a comment. Likewise, a # appears in certain parameter-substitution constructs and in numerical constant expressions(BASE#NUMBER).) |
; |
Command separator [semicolon] |
;; |
Terminator in a case option [double semicolon] |
;;&, ;& |
Terminators in a case option (version 4+ of Bash) |
. |
"dot" command [period]. Equivalent to source. |
. |
"dot", as a component of a filename. |
. |
"dot" character match. As part of a regular expression, a "dot" matches a single character. |
" |
partial quoting(soft quoting) |
' |
full quoting(hard quoting) |
, |
comma operator. Link together a series of arithmetic operations. All are evaluated, but only the last one is returned. The comma operator can also concatenate strings. |
,, , |
Lowercase conversion in parameter substitution(added in version 4 of Bash). |
\ |
escape. |
/ |
Filename path separator |
` |
command substitution. The `command` construct makes available the output of command for assignment to a variable. |
: |
null command. It may be considered a synonym for the shell builtin true. The ":" command is itself a Bash builtin, and its exit status is true(0). The ":" also serves as a field separator. |
! |
reverse (or negate) the sense of a test or exit status. From the command line, the ! invokes the Bash history mechanism. |
* |
wild card. The character serves as a "wild card" for filename expansion in globbing. The * also represents any number(or zero) characters in a regular expression. |
* |
arithmetic operator. |
** |
A double asterisk can represent the exponentiation operator or extended file-match globbing. |
? |
test operator. |
? |
wild card. The ? character serves as a single-character "wild card" for filename expansion in globbing, as well as representing one character in an extended regular expression. |
$ |
Variable substitution(contents of a variable). |
$ |
end-of-line. In a regular expression, a "$" addresses the end of a line of text. |
${} |
Parameter substitution |
$*, $@ |
positional parameters. |
$? |
exit status variable. |
$$ |
process ID variable. |
() |
command group. A listing of commands within parentheses starts a subshell. |
() |
array initialization. |
{xxx,yyy,zzz,...} |
Brace expansion. No spaces allowed within the braces unless the spaces are quoted or escaped. |
{a..z} |
Extended Brace expansion. |
{} |
Block of code. Unlike a command group within (parentheses), as above, a code block enclosed by {braces} will not normally launch a subshell. |
{} |
placeholder for text. Used after xargs -i(replace strings option). |
{}\; |
pathname. Mostly used in find constructs. The ";" ends the -exec option of a find command sequence. It needs to be escaped to protect it from interpretation by the shell. |
[] |
test. Note that [ is part of the shell builtin test(and a synonym for it), not a link to the external command /usr/bin/test. |
[[]] |
test. More flexible than the single-bracket [] test, this is a shell keyword. |
[] |
array element. |
[] |
range of characters. As part of a regular expression. |
$[...] |
integer expansion. Note that this usage is deprecated, and has been replaced by the ((...)) construct. |
(()) |
integer expansion. |
> &> >& >> < <> |
redirection. |
<< |
redirection used in a here document. |
<<< |
redirection used in a here string. |
<, > |
ASCII comparison. |
\<, \> |
word boundary in a regular expression. |
| |
pipe. |
>| |
force redirection |
|| |
OR logical operator. |
& |
Run job in background. Within a script, commands and even loops may run in the background. |
&& |
AND logical operator. |
- |
option, prefix. |
-- |
The double-dash -- prefixes long (verbatim) options to commands. |
- |
redirection from/to stdin or stdout. |
- |
previous working directory. A cd - command changes to the previous working directory. |
- |
Minus. |
= |
Equals. Assignment operator. In a different context, the "=" is a string comparison operator. |
+ |
Plus. In a different context, the + is a Regular Expression operator. |
+ |
Option. |
% |
modulo. In a different context, the % is a pattern matching operator. |
~ |
home directory. |
~+ |
current working directory. |
~- |
previous working directory. |
=~ |
regular expression match. |
^ |
beginning-of-line. In a regular expression, a "^" addresses the beginning of a line of text. |
^, ^^ |
Uppercase conversion in parameter substitution (added in version 4 of Bash). |
whitespace |
In variable assignment context, whitespace is not permitted. To preserve whitespace within a string or in a variable, use quoting. |