Understand a dialect in the Linux Shell: 2>&12016-11-14 Du Yishu ObjectiveWhen using Linux commands or shell programming, this usage often encounters 2>&1 If it is just beginning to touch Linux, this thing really does not understand, because he has
The numerical computation of a variable is like a command.(()), let, expr, BC, $[]Here's a look at the operator of numeric calculations650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8C/92/wKioL1hwVHaicj-lAAEicHK4YyY296.png-wh_500x0-wm_3 -
Bash provides a number of shortcut keys, the following are the most commonly usedCTRL + A cursor moves to the beginningCtrl+e cursor moves to end of lineCtrl+l Clear ScreenCTRL + C terminating processCTRL + Z Hang up processCtrl+u Delete the
3. Bash 's basic features3.1 Historical Command and command completion (1) History command :#history [Options] [history command Save file]① option:-C: Clears the history command;-W: Writes the history command in the cache to the file ~/.bash_history(
Bash featuresTerminal, the interface program attached to the terminal:Gui:kde, GNome, XFCECli:/etc/shellsBashZshFishFeatures of bash:Command line expansion: ~, {}Command aliases: Alias, UnaliasCommand history: HistoricalFile name wildcard:
Loops in any programming language are more than enough, and of course the shell script also has a looping statement, including a for statement, while statement. This article mainly uses the actual use case to illustrate what common use methods and
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
First, you need to make sure that the results of the shell command execution are $0 or not 0 can only represent the execution of this statement, for example: Execute statement: ADB connect 192.168.XX. XX execution Result: Unable to connect to 192.168
1.1 IntroductionThe shell is a C language scripting language, it is the user and Linux bridge, the user input command to the shell processing, the shell will be the corresponding operation to the kernel (Kernel), the kernel to the results of
1. A SHELL script that does not log logs is bullying!We often encounter a problem in our work, what exactly does a Shell script do, when it starts executing, and when it ends. Especially database backup, we would like to know our MySQL database
See the shell, write a script to set the parameters of the network card try it. It's inefficient, but it's a good use.===================#!/bin/bashLang=zh_cn. UTF-8Clear #Select the network cardecho "' Date '"Echo-e "\033[34m Select Network Card
The following methods can not install the BC calculatorCreate sh fileCheck------------------------------------------------------------------v#!/bin/Bashread-P"Please enter the first number"Aread-P"Please enter a second number"Becho"and the"' Expr $a
Distribution system: Used for multiple server code or software simultaneous distribution of execution1.install–y Expect installation expect program for automatic login to remote server2. Write Automatic Login ScriptVim Hu.expect#! /usr/bin/expectSet
Ctrl + A: Moves to the beginning of the currently edited command,Ctrl + E: Moves to the end of the currently edited command line,Ctrl + F or->: move by word aligns (toward the end of the command line, forward)Ctrl + B or Alt + F: Move right by word (
1. Shell Script Parameters
The $n represents the nth parameter passed to the script, for example, $ $ = 1th argument, and $ = 2nd parameter ....
$# number of command-line arguments
The name of the current script
$* returns the
Used in shell programming to determine parameters within an if statement–b return True when file exists and is a block file-C Returns True when file exists and is a character-D returns True when pathname exists and is a directory-E Returns True when
Under BASH2, you can use the ($ ()) combination to obtainVar= ($ (cat/etc/passwd |awk-f ': ' {print $} ' |head-3))Returns the full value of the array:Echo ${var[@]}OrEcho ${var[*]}To take an array of members:echo ${#var [@]}Orecho ${#var [*]}Take a
#!/bin/bash#a_sub () { sleep 5}multi_thread () { thread=5 # define the number of threads here tmp_fifo= "/tmp/$.fifo" /usr/bin/mkfifo $TMP _fifo # Create a new FIFO type of file exec 6<> $TMP _fifo /bin/rm -f
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.