A shell script must have been written as follows:
If [-D dir]ThenEcho "success"ElseEcho "failed"Fi
When talking about if, the book will mention the following two rules:
1. There must be spaces on the left of "[" and;
2. If you want
Bash
Shell has two popular shortcut key styles: emacs-based and VI-based, and can switch between them.
Set-o vi # Switch to VI StyleSet-O Emacs # Switch to the Emacs Style
It is based on Emacs by default, which I like very much. After all, I
It has been a while before the first post has been changing the series. At that time, I was just in touch with shell scripts and will be used temporarily at work. Learn the same thing, love the same, step by step.
1. Single and Double quotation
Author: gnuhpcSource: http://www.cnblogs.com/gnuhpc/
I. "'$ var '"In this way, you do not need to change the habit of using the awk program. It is a common method used by foreigners. For example:Var = "test" awk 'in in {print "'$ var '"}'In this
According to the shell programming of laruence's private dish, there is an inexplicable problem.For example:
# Test if else
Read-P "input y/n? : "YN
If [$ YN = "Y"]; then
Echo "continue ;"Elif [$ YN = "N"]; thenEcho "break ;"ElseEcho "PLS
2.1 What is Shell
Interpreted language, which is not suitable for jobs that are picky about execution time or have a large processor.
Shell is a program that acts as an operation interface between users and Unix systems. File
Http://blog.chinaunix.net/u/29289/showart_407859.html
A read operation can assign values to multiple variables at a time, but only one row can be read at a time. For example:
#! /Bin/bash ifs =: Read aa bb cc
In this article, through the summary of variable declaration, loop statements, condition judgment, and data superposition in shell scripts, most scripts of Linux daily management can be solved.
1. Variable declaration:
Is a weak language, with name =
Location parameters can be used
shiftCommand left shift. For example
shift 3Indicates the original
$4Change
$1, The original
$5Change
$2And so on.
$1,
$2,
$3Discard,
$0Do not move. Without Parameters
shiftThe command is equivalent
shift 1. Very
First, you need to first understand how awk works: 1. Awk reads one row of the input file at a time. 2. For each row, it matches in the given sequence mode. If it matches, the corresponding action is executed. 3. If no pattern match exists, any
Button action
CTRL + a move to the beginning of the line
CTRL + e move to the end of the row
CTRL + B move the cursor one character to the left
CTRL + F move the cursor one character to the right
CTRL + C terminate the processCTRL + z pending
11.5
Dangdang ~~~ Class ~~~ Pai_^
As mentioned above: $ cat ; after file, the results of files with original content are washed away ﹗
It is not difficult to understand this concept. This is just a matter of priority:
* In Io redirection, The stdout
Common shells are mainly divided into two major types:
SH:
Burne shell (SH)
Burne again shell (BASH)
CSH:
C shell (CSH)
TC shell (tcsh)
Korn shell (Ksh)
Bash is one of the most successful products in the GNU project. It has been widely used in UNIX
1. Create and run Shell programs
What is a shell program? Simply put, a shell program is a file containing several lines of shell or Linux commands.
Like programming in advanced languages, writing a shell program requires a text editor, such as VI.
The issue is that in w2k3 Telnet Server(Tlntsvr.exe) no longer runs as LocalSystem and needs to run the CMD Process(Cmd.exe) usingCredentials of the logged in user. If Secondary Logon Service is notStarted, TelnetServer process cannot start the CMD
Read files by row:Java code
While read myline
Do
Echo $ myline
Done
This program is to put the input file/Etc/passwdOne output.
If we only need to output username and home directory, We need to parse the file.Each row is roughly as follows,
In Windows, there are some files that can be decompressed by yourself, that is, the so-called self-decompressed files. You don't need to know which compression technology is used to compress the file, you can simply decompress the file by running
History display command history list
← (Ctrl + p) display the previous command
Hide (Ctrl + n) display the next command
! Num: The num command in the History list.
!! Run the previous command
!? String? Execute the latest command containing string
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.