Give you a full, you in the Linux environment to try to understand more:The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number
Zhanhailiang Date: 2014-10-181. Load the configuration file sequence during the Linux login process:/ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]You can view the default ~/.BASHRC file as
There are three main forms of processing Linux input in shell scripts:1) Treat them like command line arguments, and obtain corresponding input parameters by corresponding positional parameters2) through getopt and getopts These two commands 3)
declaring the execution program#!/bin/bashUsed to tell the system to use the/bin/bash program to execute the script. For example, a Python script can be written like this:#!/usr/bin/pythonassignments and referencesAssignment formula:Variable name =
Tag: Shell Before answering the questions in this chapter, let's first understand the concept of return value!Each Command or function we run in shell will return a value of the parent itinerary at the end,Return Value.Available in shell command
1. Use grep (the result is enclosed in parentheses. I wonder if I can match the content in the brackets only)
$ A = 'abc [EDG] adfirpqu '$ echo $ A | grep-O '\[. * \] '# escape [EDG] $ B = 'abc (EDG) adfirpqu' $ echo $ B | grep-O '(. *) '(EDG)
2.
Basic usage of hbase Shell
Hbase provides a shell terminal for user interaction. Run the hbase shell command to enter the command interface. Run the HELP command to view the help information of the command.
The usage of hbase is demonstrated using
Tag: String null
Integer comparison:
-EQ equals to, for example, if ["$ A"-EQ "$ B"]
-Ne is not equal to, for example, if ["$ A"-ne "$ B"]
-GT is greater than, for example, if ["$ A"-GT "$ B"]
-Ge is greater than or equal to, for example, if ["$
Use 'grep' to search for text files
If you want to find a string in several text files, you can use the 'grep' command. 'Grep' searches for the specified string in the text. For example, if you are searching for a file with the string 'Magic 'in the'
1. Five methods for calculating the value:
(I ++ ))
Let I ++
I = $ (expr $ I + 1)
I = $ (echo $ I + 1 | BC)
I =$ (echo $ I 1 | awk '{printf $1 + $2 }')
2. The time command is used to
1. The length of the string, for example:
* $ Var = "Get the length of me"
$ Echo $ {# var}
20
* $ Expr length "$ Var" # note that double quotation marks are used.
20
* $ Echo $ var | awk
#! /Bin/basffe [$ #-EQ 0]; then Echo "the input value cannot be blank." // The system prompts that null values cannot be entered. Note: $ # indicates the number of environment variables exitfinum =* * // defines a global variable to facilitate the
Shell obtains the gateway and modifies the IP address to enable the NIC.
#! /Bin/bash # autho freefei # script is a init computer ETH # data 2014 10 09 192.168.1.1netstats =$ (netstat-r | grep default | cut-f 10-d ''); echo $ netstats; # change
The script is as follows:
#! /Bin/sh # Name of the process to be checked progress_name = "heihu_server" # ------------------------------- # function: checkprogress # function: Check whether a process exists # parameter: $1 --- Name of the process to
Labels: Bash internal and external commands
What is an internal command? What is an external command?Internal commands: commands provided by the shell programExternal command: executable program in a path inside the system.
The search for
READ command-N (do not wrap)-P (prompt statement)-N (number of characters)-T (wait time)-S (do not echo)
1. Basic readThe read command receives input from standard input (keyboard) or input from other file descriptors (as described later ). After
Use shell scripts to analyze Nic status information
Question:
Shell programming1. Write a script to read the traffic on the NIC, the number of packets received and sent, the number of packet loss, and the packet loss rate;2. The NIC name must be
--- Content from http://www.jb51.net/article/31232.htm
By default, values assignment and operations in shell are processed by strings,1. Example of an error methodA)Var = 1 + 1Echo $ VaRThe output result is 1 + 1. Tragedy.B)Var = 1Var = $ var +
What is the difference between $ @ and $ * in shell learning?
Before talking about $ @ and $ *, you must start with the positional parameter of shell script...We all know how variables are defined and replaced.However, we also need to know that
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.