before starting the code, let's take a look at what a shell is. Shell English is also called the shell layer. In a computer, "system" software that "provides user interface", usually refers to the command parser of the command line interface. In
#for循环#格式#for variable in list#do# Command1# Command2# ...#doneA sequence of #列表是一组值 (numbers, strings, etc.), each separated by a space. Once per loop, assign the next value of the list to the variable#in list is optional, if it is not used, the
#while循环: Used to continuously execute a series of commands and to read data from input files; commands are usually test conditions#格式如下:#while expression#do# Statement to being executed if expression is true#done#命令执行完毕, control returns to the top
As a result of the recent scripting, with exec, haha, today simply record a bit to deepen the impressionEXEC Execution ProgramAlthoughexecand theSourceis executed directly in the parent process, butexecthis andSourceThere's a big difference,Sourceis
1. Display normal stringEcho " Boring "2. Show escape charactersEcho " \ "It is a test!\" ";3. The read command reads a line from the standard input and assigns the value of each field in the input row to the shell variable#!/bin/shecho"$name It is
1 loops (Command execution ... But the parameter will change)As in the following form:#!/usr/bin/env bash#encoding=utf-8a= "Value1value2value3value4value5value6" for I in $ado echo "cmd $i argv" doneNote: $a cannot be written as a "$a", otherwise it
This article is part (iv) of the Linux Shell Series tutorial, more on the Shell Tutorial: Linux Shell Series Tutorials
Like many programming languages, there are annotation symbols in the shell, and today we introduce the syntax and usage of
1. Wildcard characters in the shell environment* 0 to multiple arbitrary characters? An arbitrary character[] a character in parentheses[-] All characters in the sequence[^] a character, and a character that is not in parentheses2. Special symbols#
Gets the names of all the folders under the specified directory/usr/and outputs:Shell code:1#!/bin/Bash2 #方法一3 dir=$(ls-l/usr/|awk '/^d/{print $NF}')4 forIinch$dir5 Do6 Echo$i7 Done 8 #######9 #方法二Ten for dir inch$(ls/usr/) One Do A[-D
Python is a very easy way to solve repetitive strings, such as a= "James", so to get "Jamesjamesjames" is "a*3".But this "*" string multiplication in the shell is not, for example, "to output 10 a", do not want to use for the loop to do, how to
1. Basic Scripting functions1.1 Definition of functionFunction name { commands}OrName () { commands}1.2 Simple example#!/bin/shfunction FUNC01 {echo "This is the function of FUNC01"}FUNC02 () {echo "This is function of FUNC02"}FUNC01FUNC02
The Find command is used primarily for file or directory lookups.-print indicates that a matching file name is printed-print0 indicates that each matching file name is printed using the ' \ \ ' delimiter-name: Find by file name-iname Ignore letter
Common Options list all files under the directory contain hidden files ls-a list file properties and sort by modified ls-lt list file attributes and sort the file's most recent read time LS-LTU list file attributes and sort files by file size Ls-ls
Color configuration involves the following places (I often use): command prompt, file and directory name display, ECHO-E command1. Color values are divided into foreground and background colors, and the corresponding relationship of color code
1. Variable and variable values (expanded)If you need a variable name, use the variable name directly, or if you need a variable value, use the $ symbol. For example:Export Path=/home/bin: $PATHIf you're not sure if you want the variable or expanded
The function of the WC (Word Count) command in a Linux system is to count the number of bytes, words, and lines in the specified file, and to display the output of the statistic results.1. Command format:WC [Options] File ...2. Command
Enter UNAME-A in the command line mode, for example, when the interface shows i386 that the Linux system is version 32, download the corresponding JDK version on the official website, or load it directly onto my network disk
Share a concurrent script that simulates multithreading under Linux, using this script to execute related commands on a defined number of servers at the same time, which is much more efficient than a normal for/while loop and can be executed in a
1.Understanding the main function, UIApplication is the core of the initialization program, which accepts 4 parameters. where argc and argv two parameters from main () accepts two parameters, the other two string parameters represent the main class
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service