&&Command 1 && Command 2: If this command executes successfully && then execute this command.[Development]/usr/xxxx/ytcclb>ls-l Test.sql-rwxr--r--1 xxxx Group Nov 14:12 Test.sql[Development]/USR/XXXX/YTCCLB>CP Test.sql Test.bak && echo "Coping file
This article mainly introduced the shell in the For loop summary, this article explained in the shell for the loop usage, the shell for the loop's several methods and so on content, needs the friend to be possible to refer to under
About the shell
Various points of knowledge are written in the notes.
Only need sudo $PATH/ftpsetup.sh, default to test/test for user name password login, after the root directory read-only, subdirectory writable writable.
Test OK on Ubuntu 13 and Linux Mint 15.
The meaning of "2>&1" in the Linux shell
Script:
nohup/mnt/nand3/h2000g >/dev/null 2>&1 &
For & 1 It is more accurate to say that the file descriptor is 1, and 1 generally represents stdout_fileno, which is actually a dup2 (2) call. He standard
Randomly generated 10 8-bit password shell scripts1. First Capital Letter2. Middle six-digit alphanumeric random mixing3. Eighth place [0-9]
#!/bin.bash for
i in {1..10}
do
a= ' head-c 500/dev/urandom | tr-dc a-za-z | tr [A-z] [a-z]|head-c 1
Copy Code code as follows:
#include
#include
int main ()
{
Char castdoutline[1024]; One line of information in the standard output of the PS command
char* pctmp = NULL; A string that points to a space split
Char caselfpid[10]; PID
One of my colleagues once asked me this question: how do I delete all files in the directory except some files under Linux? At the time, I told him that he could solve it by pattern matching. But in fact, besides, there are other methods, which are
Copy Code code as follows:
#!/bin/bash
#author: 505056357@qq.com
echo "Backup Job Start"
#设置要备份的网站目录, that is, the root directory of the Web site
File=/home/wwwroot/default
#设置本地备份目录, for storing the packaged files
1. Take the length
Copy Code code as follows:
Str= "ABCD"
Expr Length $str # 4
echo ${#str} # 4
Expr "$str": ". *" # 4
It seems that the second type is commonly used
2. Find the position of substring
Copy Code code as
Shell variable Detailed
What is a variable? Why should I use a variable?
The concept of "variable" is used in various shell environments, and shell variables are used to store specific parameters (values) that the system and users need to use, and
Suppose a scenario that requires the same command to be executed at multiple nodes (considering the uncertainty of the command), typically using a for loop, called directly by SSH. Example: You need to see the root usage of each node:
In fact,
Shell Basics (i)* represents 0 or more arbitrary characters? represents an arbitrary character# Comment symbol, comment description meaning, that is, the content behind the # Linux ignored, or in the shell script to explain the symbol, explain the
Shell Basics (iv) Uniq and TeeUniq is used to repeat the row, the most common option is only one, that is,-C count counts the number of repeated rows, and writes the number of repetitions in front.Note: Use the premise that you need to sort the
Collect a simple shell learning document:Link:http://c.biancheng.net/cpp/view/6994.htmlThe shell itself is a program written in C, which is a bridge for users to use Unix/linux, and most of their work is done through the shell. The shell is both a
1. Iterate over each line in the file while read line; Do Echo $line; Done file. txtOrCat file. txt | ( while read line; Do echo $line; done)OrCat file awk ' {print} '2. Iterate over a word for inch $line; Do Echo $word; Done3. WC statistics
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