The syntax format of case is as follows:Case VaR inExp-1) command body 1 ;;Exp-2) command body 2 ;;...*) Command body ;;Shell calculates the value of the variable VAR, and compares the result with the formula exp-1 and exp-2 until a matching formula
1. Use multiple commands
To run multiple commands together, you only need to input them to the same line, separated by semicolons.
Ex: data; WHO 2. Create a script file
(1) #! /Bin/bash is the first line
(2) # Add comments.
(3) Each line
[-A file] true if the file exists. [-B file] If the file exists and is a special block file, it is true. [-C file] If the file exists and is a special character file, it is true. [-D file] If the file exists and is a directory, it is true. [-e
Use shell commands to stop or run services --- Service
# Service xinetd stop // stop running the xinetd service
Stopping xinetd:
# Service xinetd start // start the xinetd service
Tip: sometimes when we use Linux for Internet access, we cannot
1. write scripts. You can use shell and Perl. Find 100 files starting with ABC in the/tmp directory, and save the first line of these files to file new.2. write scripts and use shell and Perl. Put all the rows in file B but not in file,Save as file
I just learned shell and encountered a problem. The total error occurred during execution: Unexpected
Operator. I used Ubuntu 9. 04. I learned from laruence to go to the shell script section,
The script is as follows:
#! /Bin/bash
# Program:
#
The following are all from network collection. I sorted it out myself and only sorted out some things that I was not familiar with before, but will be used now:I. Definition of variables in makefile:1. recursive expansion: the variables defined by
Opening Remarks: here we will record some common bash commands, for example, memo and hope to help others solve some problems.
1. Check whether the file exists
if [ -f ./foo.txt ]then echo the file existsfi
2. Check whether the directory exists
1. Glossary:
The following is Wikipedia's explanation:
Here document[1], also known as heredoc, hereis, here-string or here-script, is a shell (such as SH, CSH, KSh, Bash, powershell, and zsh) in the command line) and define a string method in the
For, while,1. For command
ForVaRInList
Do
Commands
Done
Provide a series of values for iteration In the parameter list.(1) read values from the list
VaR is used to obtain the value in the list in this loop. In addition, the variable VAR
Structured commands: Allow scripts to skip or execute these commands cyclically based on the conditions of variable values or the results of other commands
1. Use the if_then statement
If command
Then
Commands
Fi
Run the command after if first.
Obtain the date of the current day
Date + % Y-% m-% d
Output: 2011-07-28
Assign the current date to the date variableDate = $ (date + % Y % m % d)
Sometimes we need to use the date before or after today, then we can use the-D parameter of
Author:North SouthSponsorship:From:Linuxsir. orgAbstract:This document describes several tools used in user management, including ID, finger, groups, W, WHO, and users;
Directory Index
1. Principles of user query tools;
2. user and group query
Common System Variables$0 name of the current program$ N the nth parameter of the current program, n = 1, 2 ,... 9$ * All parameters of the current program (excluding the program itself)$ # Number of parameters of the current program (excluding the
1. Use shell programming to determine whether a file is a block or character device file. If it is copied to the/dev directory.
#! /Bin/bash# 1.sh# Determine whether a file is a character or a block device file. If it is copied to the/dev directory#
1 Have you ever wondered why SED is called sed?
Sed is short for stream editor. Sed is a stream editor. To put it bluntly, we enter a string of information into SED, which is processed and output. That's simple.
Similar to cut, sed is a row-oriented
5 is there an option in sed? Is there anything that is commonly used?
Sed's most important part is the command part. If you have played this part, you are already very good. The premise of playing this part is to play with the regular expression.
My platform: Ubuntu 10.04Solution 1:Lsusb, view the vendorid, and add or modify the 51-android.rules file in the/etc/udev/rules. d/directory.Add a record:Subsystem = "USB", sysfs {idvendor} = "XXXX ",Mode = "0666" where XXXX is the value obtained
Http://blog.csdn.net/wike163/article/details/7289586
Android has an interesting command calledDumpsysTo dump some system information. Even described on ADB manual IThink that some points shocould be reinforced. In order to get the complete status
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