Basic Bash Shell command--1

1.manAccess the manual pages stored on your Linux system. You can use the Man command to view a command.Eg:man ls man Mans2.cdSwitch directories. The path to the directory has an absolute path and a relative path.EG:CD. Switch to upper-level

Shell Script Process Control

4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)

Shell Basics Using Notes

Create 10 user user1-user10;[Email protected] ~]# vim user.sh#!/bin/bash #注释为bashFor ((i=1;i#条件Do #动作Useradd user$i # Add user, $i as variable (i=i+1, always execute to iecho "User$i" | passwd--stdin user$i #打印出来, create user password consistent

Shell variable operation

1. Define variables: In order to avoid conflicts with environment variables, generally lowercase: such as pp= "mydql,kdkfeof";Second assignment scheme:The calling variable uses the $ symbol:Variable overlay:2. The output uses ECHO, as shown in:3.

"Linux rookie 2" Shell Base command

Diffdiff file File1 to compare two different files-C display rows around the top and bottom-U uniformly output patches in a certain format-R comparison of files in two directoriesPatch File File.path Patching-B Plus-B backup source filesgrepgrep Key

Shell file processing Tools

vim/etc/resolve.conf View DNS6.shell script Commands1.diffDiff file File compares the differences of two files-C Displays the surrounding rows-U generates patches in a uniform output format-R comparison of files in two directoriesPattch file

8 ways to intercept shell script strings

Tag: The shell operator represents the deletion of the first character net article BSP comSuppose there is a variable var=http://www.aaa.com/123.htm.1. # Intercept, delete the left character, leave the right character.Echo ${var#*//}where Var is the

Basic shell command

###### #shell脚本命令 ############# #1. grep command #######grep keyword File | directory # #在文件或目录中查找含有关键字的行Grep-i # #忽略大小写-N # #显示关键字所在的行-C # #显示过滤结果的个数-V # #反向过滤-e "keyword 1| keyword 2" # #过滤多个关键字-R Directory # #在目录中查找含有关键字的文件Note: ^ keyword #

Let and expr shell operations compare let's win

Integer operations in shell scripts are generally implemented by the two instructions of let and expr, such as the variable s plus 1 can be written: let "s = $s + 1" or s= ' expr $s + 1 'The two are not easy to write, but the performance of the

Shell scripts for daily use

gpg

1, shell implementation without password loginhost=$1ssh-copy-ID"Password: " "123456\r"expect eofeof2. A node-categorized shell scriptnetwork="eth0"host1=`uname-N ' base=`uname-n|Cut-C1-3' Id1=`uname-n|Cut-C4-6`if((Ten# $id 12==1)); Then((Id2=Ten# $

Shell shortcut keys

Ctrl + A cursor moves to the beginning of the lineCtrl + E cursor moves to end of lineCtrl + R Search in the history commandCtrl + L Clear ScreenCtrl + U Clear the cursor to the beginning of the characterCtrl + K Clears the character of the cursor

Shell Cutting Scripts

#!/bin/bash#return error code#0: Success#1: Parameter Error#6: Custom.log file is empty#7: Cut File Error#8: Up log file successTar_dir_file_max=30main_log_file_max=1024Main_log_name= ' Custom.log 'Cut_main_log_file= "custom_$ (date +"%y%m%d%h%m ").

If the shell determines that a variable is empty

1. The most straightforward and straightforward judgmentWithout those if statements, directly shorten the amount of code.2. The variable is caused by "" quotation marksAs shown below:, you can get the result is NULL.#!/bin/sh a= if [!-n "$a"];

Special usage of $0,$?,$! in shell

Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a glance using the SET command$*All parameter lists. such as "$*" in the

Shell Command _awk command

# awk ' Condition 1{action 1} Condition 2{action 2} ... ' File namecondition (Pattern):Generally use relational expressions as conditions x > 10 to determine if a variable x is greater than 10x>=10 greater than or equal to xactions

Shell Learning Questions

Write a script:1. Prompt user to enter a user name2, display a menu to the user. Shaped likeU|u Show UIDG|g Show GIDS|s Show SHELLQ|q quit3. Remind the user to select an option and display the Selection of contentIf the user gives an incorrect

Shell Note 4

Metacharacters and descriptions commonly used in regular expressions Metacharacters Symbol name Description \ Back slash Escape character | Pipeline Or []

Shell Script Raiders (learning note)--1.12 Read basics

To interact with Linux, the script gets keyboard input results that are essential, and read can read the keyboard input characters. 1. Restricting input characters For example, after you enter 5 characters, you end up with 5 characters entered into

Shell Script Raiders (reading notes)--1.10 debug scripts

Using Sh-x or this bash-x, you can debug a script that outputs and outputs a state for each row while debugging, and It also shows the order in which the commands in the script are executed . You can also use set in the script to set the debug area.

Shell Script Raiders (learning notes)--1.7 array

There are two types of arrays in bash: normal arrays and associative arrays. An ordinary array can use integer values only as an array index, and associative arrays may use strings as indexes.1.7.1 Normal ArrayDefine an array in one way:[Email

Total Pages: 541 1 .... 353 354 355 356 357 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.