1: Errors in redirection and output are directed to the same file in the following way:
such as:ls + 1>list.txt 2>&1 or ls + &>list.txt
Instead of ls + 2>&1 list.txt
2:-exec {} \; This is a command format, not a newline, there is a space in the middle and \ need to be directly connected;
{} Replace output in-exec
The time in the 3:time is:
Atime: Access time;
Mtime: modification time; (mainly content)
CTime: Change the time; (mostly permissions)
The above is in days, Amin, Mmin and Cmin are minutes.
4:if [] The middle command on both sides of the blank lattice;
Logical commands that can be used in the middle [] and [] for && and | | ;
[] The logical commands that can be used internally are-a (and) and-O (or);
use [[]] for string comparisons without errors.
5:echo-n does not wrap, Echo-e explains the following \ t for special commands.
6:\e[31m is a character color; 31m--37m \e[41m is the background color 42m--47m the previous; \e[0m resets the color.
7:printf is the same as in the C language. Print takes \ n as a newline character; Print0 is a newline character.
8:pgrep Remove the process number. Environment variables for the process:/proc/pid/environ
9: Get the length of the variable: length=${#var}
10: You can use $ (()), $[], and let in arithmetic operations.
11: Accuracy Determination: echo "scale=2; 2*0.15 "| Bc
12: Binary conversion: echo "obase=2;9999" |BC obase can be any binary (2, 8, 16, 60, etc.)
13: $ $ is the first parameter, [email protected] is extended to "$", "$", "$", $* is expanded to "$1c$2c$3" C is the IFS qualifier (for example, space or:, etc.).
This article is from the "Operations, database" blog, please be sure to keep this source http://startxx.blog.51cto.com/9565498/1572080
Shell scripts in Linux note the essentials