One, for loop[email protected] shell]# cat for.sh#!/bin/bashFor i in ' seq 1 10 '; Doecho "$i"DoneWith this script you can see the basic structure of the For loop:The condition of the for variable name in the loop; do Commanddone[Email protected]
The previous period of time to maintain the server, need to install the LNMP environment, so I tidied up a bit, as a script, recorded.#!/bin/sh#copyright (c) 2010-2015 redapple ([email protected]) #install lnmp # version 0.1.1#date 20140813#------
Format: "\033[display mode; front color; background color m string \033[0m"\033: Starting an escape sequence[: Start Color definitionThere are several ways to display the method:0 Terminal default settings1 高亮显示4 使用下划线5
1. Shell Script debuggingUse the SH command to check the syntax of the shell and trace the execution steps. SH [-NVX] script.sh-n: Do not execute script, only check for syntax problem-V: Print script before execution-x: Print script to use2. Check
[Email protected] bin]$ sh-n restart.sh[Email protected] bin]$-N: Do not execute script, just check the syntax, if there is no output correctly, if there is an error, you will be prompted[Email protected] bin]$ sh-x restart.sh+
In another blog "Shell script implementation DB2 database table export to a file" implemented through the implementation of the script to export the DB2 database to a file, need to pass in seven parameters, the last is a string with a space, so when
Today when writing a shell script to find the need to set the user's password, and the setting of the password is interactive, so in the script is obviously not very good, so the Internet to find information, found the following two non-interactive
Similar to other programming languages, the shell supports A for loop.The general format for A for loop is: for inch List Do command1 command2 ... CommandN DoneA list is a sequence of values (numbers, strings, and so on), each separated
Today, I have a problem. The parameters behind git are tab-key, such as Git c_Search the internet for half a day to find the answer as followsToday in Linux with Useradd new users, found that the use of new users when landing, in the shell can not
Tips:1, command completion function: key2, clear screen: ctrl+l3. Delete all contents before cursor: ctrl+u4. Command history: HistoricalThen:! The command label listed in history, you can execute that command. Such as:! 188Also: Press the arrow
Divided into two partsFirst, install the B-shell interpreterInstall Cygwin eclipse to find the installed bin pathHttps://cygwin.comSecond, install the editor shelledDownload can get one: net.sourceforge.shelled-site-2.0.3help→ Install new software
Visiting the Chinaunix forum, you can often see the Nikkei, how to quickly sort a text content, or calculate the number of occurrences of a line. Most of these problems can be solved by simple sort, uniq commands.Prepare two text firstCat File1:Boys
Simple example shell program
Example 1.
#!/bin/bash#This is to show what a shell script looks likeecho "Our first example"echo # This inserts an empty line in output.echo "We are currently in the following directory."/bin/pwdechoecho "This
First, we will not introduce what shell scripts are. This blog only records every step of learning shell scripts.
First, we will introduce the basic shell rules:
The shell script is not a complex program. It is explained by line. The first line of
While do done, until do done (indefinite loop)
While [condition]
Until [condition] Do program section done
[[email protected] scripts]# vi sh13.sh#!/bin/bash# Program:#Repeat question until user input
A regular expression is a text mode consisting of common characters (such as characters A to Z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
Yesterday, in order to Configure SNMP monitoring, the shell of several esxi 5.5 hosts was changed from disable to enable on the console. After logging on to vcenter, all hosts were warned.
The process is as follows:
Select a host with a warning
What is the difference between shell Learning (and?Strictly speaking,
Because 0 is the default value of
> This method is used to export data to a file. If the file does not exist, the file is created. If the file exists, the file is cleared.
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.