The bash and shell relationships of LinuxShell Popular Understanding: Translate user-entered commands to the operating system.The shell is an interactive command interpreter. The shell is independent of the operating system, which gives the user the
First, condition testThe command test or [can test whether a condition is true, if the test result is real, the exit status of the command is 0, if the test result is false, the exit status of the command is 1 (note the exact opposite of the logical
1./dev/null/dev/zero ①/dev/null:/dev/null, called an empty device, is a special device file that discards everything written to it (but reports a successful write operation) and reads it immediately to get an EOF. In Unix jargon,/dev/null is called
This script can be placed in the/etc/init.d/directory with service RSYNCD Start\stop\status\restart management, you can also use Chkconfig for boot-start management, detailed script content as follows:#!/bin/bash# ************************************
1-100 the sum of the natural numbers: Law one: For Loop #!/bin/bash#declare-i sum=0for ((i=0;i" | awk "{print $NF}");d o if ["$state" = = ' established '];then let estab++ elif [ "$state" = = ' LISTEN '];then let listen++ else let other++ Fidoneecho
#!/bin/bash (fixed start)# Comments (in script)Cat 1.sh Viewing scripts1. Execute the Script1) Execute permissions for script firstchmod 744 1.sh or chmod +x 1.sh2) execution . /1. SH (./current path)2. Give permission to run directlychmod a+x
In the actual work of small and medium-sized to encounter a problem that is when I go to operate the deployment script, another person can also operate, this how can do, and then the small part of the thought to re-optimize the code, add a process
Https://www.shellscript.sh/variables1.htmlA variable is the name of a block of memory that can be manipulated (read, write).1, return to the tradition. -"The only way to learn a new programming language is to use it to program"try -1Create a
(a) write the series as shown below[Email protected] ding1]# bash 5.sh2/13/25/38/513/821/1334/2155/3489/55144/89233/144The shell code is as follows:#!/bin/bash>aa>bbEcho 1 2 | Xargs-n1 >AAFor i in ' seq 20 'DoA= ' Cat AA | Sed-n ' $i ' P 'b= ' Cat
When using the shell, the environment variable file is read./etc/profile: This file sets the environment information for each user for the system, and the file is executed when the user logs on for the first time.and collect the shell settings from
You can use the script to pass parameters to implement the substitution#-*-coding:utf-8-*-#Author:sunhaoImportSYSF= Open ('Yesterday','R', encoding='Utf-8') F_new= Open ('Yesterday.bak','W', encoding='Utf-8') Find_str=sys.argv[1]replace_str=sys.argv[
The shell function is similar to a shell script, which holds a series of instructions, but the Shell function is in memory, not the hard disk file, so it is fast, and the shell can preprocess the function, so the function starts faster than the
#!/bin/bash#author: The Adventures of Tintin (Jacob) #定义数组, save all the possibilities of Punch game= (stone scissors cloth) num=$[random%3]computer=${game[$num]}# Get the punch of a computer by random number # The possibility of a punch is
File Status Test
-B filename
Returns True when filename exists and is a block file (returns 0)
-C filename
Returns True when filename exists and is a character file
-D Pathname
Returns True
Reference URL: http://www.cnblogs.com/chengmo/archive/2010/09/30/1839632.htmlThe Linux shell is much more powerful in programming than Windows batch processing, and cannot be compared in terms of loops, operations, and data types. Here is a summary
1. Array definition[[email protected] ~]# a= (12345678) [ [Email protected] -IDC ~]# Echo $aA pair of parentheses indicates an array, and the elements of the array are separated by a "space" symbol.2. Array reading and Assignment1) Get the length
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.