LinuxShell special characters and control characters
Source: Internet
Author: User
LinuxShell special character and control character Shell special character # Comment represents comment # Comment represents in the middle of quotation marks and # echo itself $ {PATH ##:}# parameter replacement, not a comment echo $(2 #101011) # number conversion, not a comment www.2cto. co... linux Shell special character and control character Shell special character # Comment represents comment # Comment represents in the middle of quotation marks and # echo itself $ {PATH ##:}# parameter replacement, not a comment echo $(2 #101011) # number conversion, not a comment www.2cto.com; separate commands, write multiple commands in one line echo "aa "; if the if and then conditions of echo "bb" are placed in the same row, they are also separated by; the end of the case condition. the command is equivalent to the source command: the prefix of the source file name, hiding the file directory :. current Directory ,.. regular expression of the parent directory: matching any single character "" Reference supports wildcard extension '', without wildcard extension \ escape/directory separator, multiple commands are executed, but return the last 'post reference: operator null operation endless loop: while: In if/then, it indicates that nothing is done. the default parameter :$ {username = 'whoam'} of the outbound branch settings is replaced by: $ {HOSTNAME ?} $ {USER ?} $ {MAIL ?} When used in combination with the> (redirection operator), a file is truncated to 0 length without modifying its permissions. if the file does not exist before, it is created. for example:> data. xxx # File "data. xxx "is cleared now. and cat/dev/null> data. xxx works the same. However, this does not produce a new process, because ":" is a built-in command. when used with the> redirection operator, it will not affect the file to be appended. if the file does not exist, it is created. * matches 0 or multiple characters. it is a mathematical multiplication. ** is it a power operation? Match any character, but in (a> B? A: B )) returns the value of $ variable in the C language. in the echo $ PATH regular expression, the value of $ {} indicates the end of the row. replace $ {PAHT} $ * All parameters $ # number of parameters $ process ID $? Process return status () command group, run in a sub-Shell (a = 3; echo $ a) where the defined variables are not available in the following array initialization: array = (, b, c) {} code block, that is, an anonymous function, but the defined variables are still available {} \; $ find-name * in find-exec *. txt-exec cat {}\; [] test [-z $1] array element a [1] = 'test' [[] indicates that [[...] is used for testing. condition judgment structure, instead of [...], it can prevent many logic errors in the script. for example, the &, |, <, and> operator can normally exist in the [[] condition judgment structure, but if it appears in the [] structure, an error is returned. (()) mathematical operations in the regular expression indicate the range [a-z] <> redirect and process replacement ls-al> a.txt> <also used in ASCII comparison if [["$ veg1" <"$ veg2"] \ <, \> The word boundary in the regular expression. for example, bash $ grep '\ 'Textfile | MPs queue> | force redirect (even if the noclobber option ---C option is set ). this will forcibly overwrite an existing file. | logic or operation; when used between two commands, it indicates that when the previous command ends, if the returned value is false, continue to execute the next command & logical and; when used between two commands, it indicates that if the return value is true at the end of the previous command, continue to execute the next command & background run-parameter option minus signs to redirect stdin and stdout: cd/source/directory & tar cf -.) | (cd/dest/directory & tar xpvf-) previous working directory cd-note: the file name and variable name starting with "-" may have some problems + the option tag of a command or filter. ~ Home directory ~ + Current working directory ~ -In the previous working directory ^ regular expression, $ IFS at the beginning of the line is used to separate some input commands. by default, it is blank. control character modification terminal or text display behavior .. CONTROL characters are combined by CONTROL + key (simultaneously Press ). the control characters can also be expressed in octal or hexadecimal notation, but the front must be added with an escape character. the control characters cannot be used normally in the script. ctl-B return (non-destructive), that is, return but do not delete the previous character. ctl-C ends a foreground job. ctl-D logs out of a shell (similar to exit ). "EOF" (end of file ). this can also terminate input from stdin. when entered in the console or in the xterm window, Ctl-D will delete the characters under the cursor. when no characters exist, Ctl-D will exit the current session. in an xterm window, the window will be closed. ctl-G "beep" (beep ). on some vintage typewriter terminals, it will ring the bell. ctl-H "return" (destructive) is to delete the character of the front edge after the return. ctl-I horizontal tab. ctl-J ). in the script, you can also use the octal notation-'\ 012' or the hexadecimal notation-' \ x0a. ctl-K vertical tab. ctl-L clear screen (clear the screen display of the terminal ). in the terminal, the effect is the same as that of the clear command. when it is sent to the printer, Ctl-L will let the printer roll the print paper to the end. ctl-M press Enter. www.2cto.com Ctl-Q restore (XON ). recover stdin in a terminal. ctl-S pending (XOFF ). freeze stdin in a terminal. (use Ctl-Q to restore the input .) ctl-U deletes all characters from the cursor to the beginning of the line. in some settings, the entire line of input will be deleted regardless of the position of the cursor Ctl-U. when Ctl-V is entered, Ctl-V allows the insertion of control characters. ctl-V is mainly used for text editing. ctl-W when you input text in the console or an xterm window, Ctl-W deletes all characters between the current cursor and the nearest space on the left. in some settings, Ctl-W deletes all characters from the current cursor to the first non-letter or number on the left.
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.