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
Due to work needs, often to connect the mobile phone and use the ADB to do some operations, found that the shell function is very good, but in castration state, the most obvious one is, the implementation of a number of commands, the directory
Principle and simplicity: recursion, iconv
code is as follows
copy code
#!/bin/sh tgt= "Source_rst" Function Fe_convert () { for file in ' ls $ ' do if [-D $/' $fi Le] then
Shell BasicsFirst, Shell Overview1) The Shell is a command-line interpreter that provides the user with an interface system-level program that sends a request to the Linux kernel to run the program, allowing the user to start, suspend, stop, or even
Processing RequestsclassTestControllerextendscontroller{ Public functioninit () {if(!Yii_env_dev) { Throw NewExitexception (201, ' can not access not ' in dev mode '); } } /** * */ Public functionActionclientip ()
Why do scripts use the./+ script name to execute the scriptUnderstand:Because if the script name is used directly, then the Linux system will go to path path to findsuch as go to/bin usr/bin, such as find, this time will not find the script name,
This article mainly introduces the shell implementation of multi-level menu system Installation script instance sharing, this script with multi-level menu to achieve lamp, LNMP installation display effect, the need for Friends can refer to:Hint:
Transferred from: http://blog.csdn.net/w_ww_w/article/details/7075867Eval can read a series of parameters and then execute them according to the characteristics of the parameters themselves. Eval is a shell built-in command that can be used by 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
16. File Lookup Command find:Here's a sample of the main applications for the Find command:/> Ls-l#列出当前目录下所包含的测试文件-rw-r--r--. 1 root root 48217 Nov 00:57 Install.log-rw-r--r--. 1 root root Panax notoginseng 00:56 testfile.dat-rw-r--r--. 1 root root 1
The shell command can be executed directly in awk.[Plain]View PlainCopy
[Email protected]:~$ Touch A
[Email protected]:~$ Touch b
[Email protected]:~$ cat A.txt
A
B
[Email protected]:~$ awk ' {cmd= ' rm ' $0;system (CMD)} ' A.txt
Seven. grep family: 1. grep exit Status: 0: Indicates success; 1: Indicates that a matching pattern could not be found in the supplied file; 2: Indicates that the file provided in the parameter does not exist. See the example below: /> grep '
There are two ways to represent logic in bash:(1) [$state = = "Running"-a $name = = "Zone1"](2) [[$state = = "Running" && $name = = "Zone1"]]The second type is supported in Ksh.Instance:#! /bin/-P "pelease input your name:"-P "pleaase Input your
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
Common commands· LS View the files in the current directory· CD into a directory· CD-Jump back to previous directory· CD ~ Enter the current user's personal directory· PWD Output Current path· mkdir new Folder· Touch New File· Find File· ln
(1) Command1;command2Use ";" , the Command2 is executed regardless of whether the Command1 executes successfully.(2) Command1 && Command2When you use &&, Command2 is executed only if Command1 executes successfully, otherwise Command2 does not
The shell file containsThe shell can also contain external scripts in the following syntax format:. FileNameOrSOURCE filenameFor example, create a two shell script.Script 1:test1.sh
url = "Www.baidu.com"
Script 2:test2.sh
.
First, demonstrate the effect of rebound shell0. Look at the Python version650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8B/90/wKioL1hRTinAlo_nAAASu8q0u_A128.jpg "title=" Python.jpg "style=" Float:none; "alt="
Example 1,Cut nginx logs by date and automatically delete logs generated seven days ago (logs have been synchronized to dedicated log storage servers, so you can safely delete historical logs .)#! /Bin/bash# InitializationLOGS_PATH =/data/nginx/logs/
Online servers generally encounter a variety of log cutting. Similar detailed script articles have not been published before. This time, we will make up for the relevant content of the website. The following describes how to cut two logs, and how to
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