Positional parameters can be shift shifted left with the command. For example, the shift 3 original $4 now become $1 , the original $5 now become and $2 so on, the original $1 , $2 $3 Discard, $0 do not move. Commands with no parameters are shift
The shell is born in Unix and is a tool for unix/linux interaction, and it doesn't make sense to learn the shell alone.The shell needs to rely on other programs to do most of the work, which may be his flaw, but its undoubted strength is that the
Intra-enterprise network segment detects how many hosts are alive1) byPingLifeorder to achievePing-c 1-w 1 IP- C: indicates the numberof times , 1 is 1- W: represents deadline, time out , in seconds,1 for 1 seconds. Note: a) If one goes to ping to
Requirements:
This directory is currently created if the result directory does not exist.
If Socwatchoutput.csv is present, move it to the result directory
Then, pass the parameter kpi_name,
#!/bin/sh#Used to save CSV file#write it by
1. Location of shell configuration files
The most commonly used shells are SH and bash, which only speak sh and bash here.
1.1. SH (Bourne Shell) configuration file has two main, respectively, each user home directory
Linux Shell Common Skills (i)Http://www.cnblogs.com/stephen-liu74/archive/2011/11/10/2240461.htmlI. Special documents:/dev/null and/dev/ttyTwo. Simple command trackingThree. Regular expression basic Syntax descriptionFour. Use the Cut command to
# make direcory for backset file and scripts file,in my Case/backup/db_bakCd/backup/db_bakmkdir Scripts Logs Rman# The following is contents of Rman_backup_shVi/backup/db_bak/scripts/rman_backup_sh#!/bin/bash# author:anbob.com# Desc:rman Backup
1. you want to download a software from the server, your machine has two network cards eth0 and eth1, the address is configured as follows:Eth0 : 192.168.6.25/24Eth1 : 172.16.101.25/24 default gateway: 192.168.6.1/24 server address:211.138.18.3
Shell scripts are usually text files that start with #!/bin/bash. #! is placed before the interpreter path.Use bash as the interpreter to interpret all command-line commands.There are two ways to run a script, one is to use the script as a
Add users in bulk and set a random password to save the added user's name and password to a file.[Email protected] scripts]#CatUser.SH #!/bin/SH forIinch`seq-W Ten` DoPass=$(Echo "' Date ' $RANDOM"|md5sum|Cut-C1-8) //Take the random number method is
Chapter One: Shell Start-up basics1. Variables: In bash, the value of each variable is a string. Whenever you assign a value to a variable, there is no quotation mark, and the value is stored as a string.2, Var=value; Assignment operationvar = value;
Shell variables are divided into system variables and user-defined variablescommands to view variables#env System VariablesOr #set include env and custom variables and extra variablesThe command to use the variable is#echo $ "Variable"///////////////
In shell programming, "EOF" is usually used in conjunction with "
Interactive Program (command)
The content in the middle of "EOF" will be entered as a standard input to the "interactive program", when the shell sees
The command is placed in the "(General keyboard 1 to the left of the key), such asEcho ' DMESG | grep ETH '
The command is placed in $ (), such asecho $ (DMESG | grep eth)
Can be saved to the variable varname as followsVarname= ' DMESG | grep
ShellThree ways to do it (not original, forget who's blog) 1: . Filename 1. SOURCE command usage: source FileNameFunction: Reads and executes the commands in the filename under the current bash environment. The filename file can have no "execute
0. Internal variables in the shell:1. $?: Represents the return value of the shell command.2. $$: Represents the PID of the current shell.3. $!: The last PID value to be put into the background job.4. $ A: Indicates the name of the script.5. $1--$9,$
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.