Echo
Echo is a very common shell command. The parameters are as follows:
- -e: Turns on parsing of backslash character backslash-escaped, that is, parsing characters such as/n,/t, rather than two characters
- -E: Turn off parsing of backslash characters,/n as two characters, this is the system default mode
- -N: Delete last line break
/A: Warning ring Tone (alert or ctrl-g (Bell))
/ b: Backspace (BACKSPACE or ctrl-h)
/ C: Delete Last word indicators last line break (Omit final NEWLINE)
/ e: Remove one of the following characters (Escape character (same as/e))
/ e: Ibid. (Escape character)
/ F: Page break, in some reality will clear the screen, some will wrap (formfeed or ctrl-l)
/ N: NewLine (NEWLINE (not at end of command) or CTRL-J)
/ R: Starting from the wardrobe, not the same as line break, still in the Bank (RETURN (ENTER) or ctrl-m)
/ T: Tab key (Tab or CTRL-I)
/ v: Vertical tab, same AS/F, shows different machines, usually causing newline vertical TAB or ctrl-k
/N : Use/65 in Cygwin, cannot display ' A ' correctly but the following two methods can be displayed. ASCII character with octal (base-8) value n, where n was 1 to 3 digits
/0nnn : A 8-binary value represents a character, such as/0101, or 65, that represents the character ' A ' (the eight-bit character whose value is the octal (base-8) value nnn where nnn are 1 to 3 digits)
/ xHH : A 16 binary value represents a character, such as/x41, or 65, that represents the character ' a ' the eight-bit character whose value is the hexadecimal (base-16) value HH (one or both di Gits
Printf
printf and the C language are used in a similar way. Unlike Echo, it does not automatically add line breaks at the end and needs to be written to the command. For example printf "Hello, world/n". printf's command format is as follows:
printf format-string [arguments]
%c:ascii character, if the argument is given a string, the first character is printed
%d:10 binary integers
%i: Same as%d
%e: Floating-point format ([-]d. Precision [+-]dd)
%E: Floating-point format ([-]d. Accuracy e[+-]dd)
%f: Floating-point format ([-]ddd.precision)
%g:%e or%f conversions, if rear is 0, delete them
%g:%e or%f conversions, if rear is 0, delete them
%o:8 in the system
%s: string
%u: non-0 positive integer
%x: Hex
%x: not 0 positive, 16 binary, using A-f to represent 10-15
Percent: Indicates the character "%"
The difference between printf and echo in a Linux shell