When writing a shell script today, one of the actions is to use the grep command to search for the specified content in a file. Specifies that the content is stored in a file, using a variable to get the contents of the file, and then uploading to
Test structure:The test command can be used to test the true and false of the expression condition, and returns0,false, which is not 0; format:Test expression #expression是一个表达式, the expression can be compared by numbers, strings, text and file
Linux shell $$, $#, #!, $*, $, [email protected], $-, $0~$9 meaning$$Shell itself PID (process ID)#*All parameter lists. such as "$*" in the Case of "" ", in the form of" $ $ ... $n "output all parameters.[Email protected]All parameter lists. such
First, Introduction:HBase shell using the process, using the CRT client, the command input can not be deleted has been trapped around me, today finally unbearable, a few degrees Niang, Google, finally have a solution, special share to
File comparison Operators-e filename true if filename exists [-e/var/log/syslog]-D filename True if filename is a directory [-d/tmp/mydir]-F filename True if filename is a regular file [-f/usr/bin/grep]-L filename True if filename is a symbolic link
30.tee: Reads the standard input and then displays it by the standard output and stores the data in the specified fileExecute this command, test.txt if it already exists, it will be emptied, if it does not exist a new file will be created, end the
parameter Handling
Description
$#
The number of arguments passed to the script
$*
Displays all parameters passed to the script in a single string
$$
The current process ID number for the
Common returns in the shell are: Exit,breakm,returnExitIn fact, after each command is completed, it will return an execution state!If the execution succeeds, it returns 0If execution does not exceed, return non 0!Example application: Use the shell
The tput and printf functions are required to print the progress bar in the shell.# tput Row col cursor moves to row row column Col# tput cols Gets the maximum number of columns in a window# tput lines Get window max running script# echo $LINENO Get
Tag: Shell Determines whether the input is valid IP shell determines whether the input is a letter1. Purpose of demandRecently in the study of ansible automation tools, in the host table (/etc/ansible/hosts) Add Management node information, a few to
Script comments: in a shell script, a comment followed by the (#) number, used to annotate the script, the comment part is not executed, the comment can be self-contained, or it can be followed by the same line as the command after the script
The shell determines whether the file, directory exists, or has permissions#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X '
Before I published "Hadoop, kill chicken with sledgehammer, Python+shell to achieve the general log file query, statistics , "theneed to combine python, there may be a certain threshold, now the shell part stripping out. For example, some of the
The shell terminal only displays the user name, hostname, working directory by default, and sometimes we need to simply tweak the information displayed on the shell terminal to make the work more efficient. For example, we can add time to the shell
How to protect a shell program you've writtenTo protect your own shell scripting program, there are many methods, the simplest way there are two: 1, encryption 2, set the expiration time, following the SHC tool as an example description:I. Download
Sed is a good file processing tool, itself is a pipe command, mainly in the behavior of the unit processing, you can replace the data rows, delete, add, select and other specific work, the following first understand the use of SEDThe SED command
Long time no shell, hehe#!/usr/bin/EnvBashcounter=1 while[$COUNTER-lt + ]; DoEchoThe counter is $COUNTERCat>Tmp.sqlinsert into"Wcdata"VALUES ('' (printf "%03d" $COUNTER) '','0.00','0.00','0.00183','85.47943','4773267.7216','-10669.18'); EOFEchoThe
At work, there are times when you need to process some data, use Java to compare aspects, such as hbase, but you need to execute it in the shell, so the extra bag is harder to get into, and it's easy to package with Maven.
First Pop.xml
Shell script Learning1111111111111 clear the simple command script of the messages log file under/var/log/Var/log/the system file under the log file must have the root permission:$ UID is the global variable of the system:Make & make install
Linux shell reads files by row,One way is to use cat and reverse quotation marks.
Ps: reverse quotation marks play the role of command replacement in Linux. Command replacement means that shell can insert the standard output of a command to any
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