This article mainly introduces the Linux Shell Script series (iii): Variables and environment variables, this article explained the common variable, get the length of the string, environment variables and so on, the need for friends can refer to the
We can always see in Android development that the log log content of the program is full of screens, and the information that really makes sense to the developer is submerged in the torrent, leaving developers at a loss and seriously impacting
This is a simple shell instance.
Here is a description of its requirements:
Experiment five UNIX Shell program design
Experiment content: Use UNIX shell programming language, write Unix shell application.
Experiment requirements: The following
The use of conditional expressions in shell programming
If conditionThenCommandElseCommandFi, don't forget this ending.
If statement forgets the end fiTest.sh:line 14:syntax error:unexpected End of fi
Three
Shell--for in Cycle 2013-03-28 18:06:29 tags: for loop
Shell programming--for in loop-------for in format-------
For no $ variable in string do $ variable done a simple string enumeration of calendars, using for-in format the character of a
[awk Introduction:]
Awk can get part of the content from a single text, or typesetting the text so that it prints in some format.
[awk Workflow:]
Awk goes into memory with one line of the file, and then segments the line (by default, by Space or
Purpose of using a springboard: Our server is a cloud host, the use of AWS is more, and AWS is the private key to connect the public key, the way is connected to the root of the connection, this way, developers to connect to the server, it is
File descriptor abbreviation Description0 STDIN Standard Input1 STDOUT Standard output2 STDERR standard Error1. STDINcan come from the keyboard and can be entered from a redirected file.1 Cat 2 a #从键盘输入 3a #输出 4b #从键盘输入 5b #输出 6
There are some limitations to mathematical operations in the shell. It is mainly divided into the following types:1. square brackets-------support only integer arithmetic[[email protected] documents]$ var1=$[1+5] [email protected] documents]$ echo
Original address: http://hadoop.apache.org/docs/r1.0.4/cn/hdfs_shell.html
FS Shell
Cat
Chgrp
chmod
Chown
Copyfromlocal
Copytolocal
Cp
Du
Dus
Expunge
Get
Getmerge
Pipe character|: Pipe break is the delivery of the contents of the previous file's output to the following command[[email protected] ~]# ls |wc-l21stSee how many files are in the current directory[email protected] ~]# cat 1.txt |wc-l1View the number
There are several ways to bash a shell script, and now make a summary. Suppose we write a good shell script with the file name hello.sh, the file location in the/data/shell directory and have execute permissions.Method One: Switch to the directory
1) How do I use parameters in a script?First parameter: $ $, second argument: $ AExample: The script will copy the file (arg1) to the destination address (ARG2)./copy.sh file1.txt/tmp/Cat copy.sh#!/bin/bashcp $1 $22) How to calculate the parameters
Today wrote a shell script, the old error check the basic syntax and did not find errors. Later after the settlement of Baidu, and now summarized as follows.error phenomenon : Execute shell script, old error "syntax error near unexpected token
Speaking of secure network access, we believe that the first thing we think of is secure shell, which is usually abbreviated as SSH. This is because SSH is easy to install, easy to use, and common. Generally, UNIX, Linux, and FreeBSD systems all
Introduction
People who work with shell are familiar with shell programming in Unix/Linux. # is mentioned in all shell programming books #! /Bin/bash. What exactly does it contain? What does this string mean for the operating system? You may say,
The first and last days of this month:
Echo 'date -- Date "$1" + "% Y-% m-01 "'
Year = 'date-d "$1" + "% Y "'Month = 'date-d "$1" + "% m "'Last_day = 'cal $ month $ year | xargs | awk '{print $ NF }''
Echo $ year-$ month-$ last_day
Calculate the
1. case... in... esac
The syntax of case... in... esac is as follows:Case $ variable name in"First variable content ")Program Section;;"Second variable content ")Program Section;;*)Other Program Execution segments that do not contain the first
This article is also the second of the book note in Chapter 4 Basic shell programming of learning the bash shell 3rd edition, but we will not limit it to this.
String operation
In the following description, ":" Can be deleted. "Yes" means "exist
Shell script programming Selection Control Structure
There are two programming languages: interpreted language and compiled language. An interpreted language is an interpreted statement that can be executed on Demand Based on the process control
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.