The script that recursively iterates through the directory with the shell writes recursively traverses the specified directory and prints the file name under the directory.
Example 1:
Copy Code code as follows:
#!/bin/sh
function
Note: Do not plan to use root user directly to run Node.js service! This will lead to an unpredictable security issue!However, using port 80 as the HTTP default port is a habit that has lasted since the age of Ms. People on the Internet talk about
1) Statistics the number of files under the current folder
Copy Code code as follows:
Ls-l |grep "^-" |wc-l
2) Statistics the number of directories under the current folder
Copy Code code as follows:
Ls-l |grep
Recently, in order to do a weather forecast project, need to download some weather icons from Yahoo, but because of more than 80 icons. The icons are stored on the Yahoo image site.
Thunder does not support HTTPS downloads, although it can be
This blog is simple to look at the loop statements that Shell programming uses, including for loops, while loops, until loops, for behind and a variable, and then a collection that assigns things to this variable, each loop, like a foreach in Java.
Nagios is an open source free network monitoring tool, can effectively monitor Windows, Linux and UNIX host State, switch routers and other network settings, printers and so on. When the system or service status is abnormal, send an email or SMS
Like other programming languages, the shell supports A for loop.
For loops The general format is:
Copy Code code as follows:
For variable name in list
Todo
Command1
Command2
...
CommandN
Done
When the value of
The shell supports custom variables.
Defining variables
When you define a variable, the variable name is not a dollar sign ($), such as:
Copy Code code as follows:
Variablename= "Value"
Note that there can be no space
Shell script:
#!/bin/sh # # # Convert file from GB2312 to UTF-8 # path= "$" unset opt if ["$" = "Force"]; Then opt= "-c-s" fi if [-Z "$path"]; Then echo "Nusage: $ n" elif [!-e "$path"]; Then echo "Nerror:destination: $path does not exist.n"
We will use the common system security configuration as a shell script, only to run this shell script on the server to complete the security settings.
Linux system security Settings Shell script is the second update, has been heavily used in a
In a programming language, a looping statement is one of the most basic syntaxes, and is no exception in the shell (here is bash).This includes the For/while/until loop, as well as the syntax instance of the variable increment.
The loop statements
Search on the Internet to find a great God wrote Shell Repair Bash Vulnerability script, feel very good, dragged to my blog to share to everyone.
Script content:
Copy Code code as follows:
#/bin/bash
#Author Alex Fang. Updates may
The shell supports custom variables.Defining variablesWhen defining a variable, the variable name does not have a dollar sign ($), such as:
VariableName="value"
Note that there can be no spaces between the variable name and the equals
Linux-shell First Lesson1, through a small example to introduce the shell#! /bin/sh Call Sehllecho Print content read input cd jump directory pwd View current directory650) this.width=650; "title=" 1.jpg "src=" https://s5.51cto.com/wyfs02/M00/8D/EA/
Installation of the Linux SendEmail tool 1. Download the file #wget http://files.cnblogs.com/files/sunziying/sendEmail-v1.56.tar.gz2. Installing #yum Install SENDEMAIL3, main parameters:-F is the From, the sender address-t means to, the recipient
1. Weaknesses of Shell variables: weak type and default string type2. Declare command2.1 Declare declaring variable type declare [+/-] [option] Variable name 2.1.1 Declares a numeric type variable: declare-i c= $a + $b # A and B are not declared
#!/bin/bashExport Chknum=1#shell搅拌存放目录 (The output log file is also stored in the directory after it is executed)Echo 3 >/wls/wls81/shellSyncWhile [$chknum-ge 0]Doecho "-------------------------------------------------------" >> Trace.logmt= ' Free |
Testing and comparison of shell scriptsTest command: Checks the file type and compares the value (depending on the execution result of the expression (true or false), returns an exit status. )NAMETest-check file types and compare
CentOS 61-Key System optimized Shell scriptThe contents of the script are as follows:#!/bin/bash#author Suzezhi#this script is only for CentOS 6#check the OSPlatform= ' Uname-i 'if [$platform! = "x86_64"];thenecho "This script was only for 64bit
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.