There are several ways to see what shell you are currently using, and the easiest way is to use the shell's special parameters.
First, a special parameter named "$$" represents the PID of the shell instance that you are currently running. This
Example 1
Typical operation, traversing all JS in the directory and using Yuicompressor compression
The code is as follows
Copy Code
For i in ' Find Asset/v2-name ' *.js ';Todoecho "Compress $i"Java-jar
Date# Take the day beforedate-d ' 1 days ago ' +%y-%m-%d
Order, E-Name, set function: (alias)Alias Ll= ' Ls-al '
Some special values$$: (for this shell PID)$!: Get the process pid of the subprocess, for example the Nohup command can get the PID$: (
Problem Description:
CentOS A new user, log in after the information of the shell script is as follows:
Linux CentOS Shell display-bash-4.1$ does not display the user name path solution
Ps: If you mistakenly delete files in the user directory, it
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
File expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if
Conditional judgment, control structure:Single Branch if statementif judgment condition; ThenStatement1Statement2...FiTwo-branch if statement:if judgment condition; ThenStatement1Statement2...ElseStatement3Statement4...FiMulti-Branched if
File expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if
Shell result from CmdLineecho $?If 0 then success; else failure(Shell executes each return value, RM-RF error, package cannot overwrite)Solve Sudo:sorry, you must has a TTY to run sudo a few days ago encountered a problem, call another shell in one
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
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
#!/bin/Bash#defind the Pathpath=/usr/Localexport Pathread-P"Please input your first name:"Firstnamereap-P"Please input your last name:"LastNameEcho-E"\nyour name is: $firstname $lastname"#useDateCreatefileRead-P"Please input your
#!/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
Today, the company asked me to copy the backup files on the server to the internal server, and as long as they are up-to-date, well, what is the ideal goal of O & M personnel, that is, what can be done by computers, never do it by yourself.System:
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