The method of parameter passing in shell script is commonly used in 8 kinds
1. $# the number of parameters passed to the script
2. $* displays all parameter variables passed to the script in a single string. Unlike positional variables, this
Sometimes we need to repeat the previous commands in Bash. You can, of course, use the UP ARROW keys to view the commands you've run before. But there are some better ways, for example, to master the following shortcuts.
1)!! : Repeat the previous
1. Character truncation:If the character truncation is a generic path, you can use both the basename and dirname tools:BaseName can truncate a filename from a file path
For example:
Copy Code code as follows:
$
In Unix-like systems, symbolic links are common and we encounter a variety of processing work related to symbolic links.This article for you to introduce some of the practice of symbolic links, I hope to write a shell script to bring some help, the
Several cases of sqlplus and shell passing value to each otherScenario One: The simplest invocation of sqlplus in the shell$cat test.sh#!/bin/shSqlplus Oracle/[email Protected]>file.log SELECT * from Test;ExitEOF #注意EOF要顶格写$sh test.sh$cat
We started the Shell Script debugging series, first explaining the different debugging options, and here's how to enable Shell debug mode.After you finish writing the script, it is recommended that you check the syntax in the script before running
Create a shell scriptWhen you create a shell script file, you must specify the shell to use in the first line of the file, in the format:#!/bin/bashCreate and execute SH scriptCode 1-1[Email protected]:/data# cat demo1 #/bin/bashdatewho[email
Shell variables are used to store the specific parameters (values) that the system and the user need to use, and these parameters can vary according to the user's settings or changes in the system environment."The role of variables"Provides specific
Description: +n is greater than N,-n is less than n, n is equal to N.Find/-amin-30-ls # finds files accessed in the last 30 minutes of the systemFind/-atime-2-ls # finds files accessed in the last 48 hours of the systemFind/-mmin-10-ls # finds files
File type: Normal file, directory file, socket file, device file, link file
determines whether a file is a symbolic link file. Yes, move it to the/etc directory; No, do not handle it .
1 #! /bin/bash 2 #filename: a.sh 3 filename= 4 echo "Input
Shell Script BASIC Programming fourth articleMain contents of this chapter: functionsFunctionfunctionfunction name {command;} or name () {command;}Defines the Shell function.Create a shell function that is named name. When enabled as a simple
ShellThe first type:${parameter%word} minimal truncation of word from behind${parameter%%word} to maximize the truncation of word from the back${parameter#word} minimal truncation of word from the front${parameter# #word} to maximize the truncation
Shell script Programming "on"A program is a combination of instructions and data.Program Programming Style:Program: command-centric, data-serving instructionImage: Data-centric, command-serving dataProgramming Languages:Low Level:
When you use the HBase shell for a Get or scan operation, you will occasionally see some values being converted into 16, just like the followingvalue=w\x5c5\x80So what exactly does this value equal? The algorithm is found after reviewing the data as
Practice Environment:(1) All servers will shut down firewalls and SELinux(2) The root password for all servers is set to AIXOCM(3) All servers are 10.0.100.* network segments and are guaranteed to communicate with other hosts(4) All servers ensure
The role of Eval is to perform command-line processing again, that is, to perform two command-line processing on a single command line.1. Example 1: Using the eval technique to implement the shell's control structure forUse the Eval technique to
Linux Shell gets time and time interval (MS level)Note: While performing some performance testing, sometimes we want to calculate the time a program runs, and sometimes it is possible to write a shell script to facilitate some performance test
Excerpt from: Abs_guide: http://www.tldp.org/LDP/abs/abs-guide.pdf
The meaning of shell variable $#,[email protected],$0,$1,$2 in Linux is explained:Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's
Write a bash shell scriptThe script is as follows: it is used to monitor the number of mongo connections and restart the system.#! /Bin/bash# Source/etc/profileConn = '/usr/bin/mongo -- quiet Db. serverStatus (). connectionsExitEOF`Conn1 =$ {conn #*:
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