Call volatility in the shell script, the volatility call is normal when the local test, but when the CGI program calls the shell script, there is no result output ... Why
There may be two reasons for the analysis: (1) Permission issues (2) Python
After you understand the basic statements, you need to implement your own ideas. Start to do some judgment on the condition of learning.
Test
Test is an expression of a shell program that can be conveniently tested with strings, file states and
if [str1 = str2] When two strings have the same content, the length is true
If [str1!= str2] True when string str1 and str2 are unequal
If [-N str1] is true when the length of the string is greater than 0 (string non-empty)
If [-Z str1] is true when
Phenomenon: Prompt source:not found when source aaa.sh in shell script
Reason: Ls-l ' which sh ' hint/bin/sh-> dash
This means that the dash is used to parse.
Change Back method:
Command line execution: sudo dpkg-reconfigure dash
Select No
The Backstage execution command, is puts the shell command to the system backstage to execute, does not display in the terminal, does not affect the user to continue to work in the terminal, even if the terminal closes the command also to
When using the shell under Linux, the array is occasionally used for convenience. The array is declared in the following way:
array= (element1 element2 element3 ... elementn)
That is, wrap the array elements of the parentheses package together,
LINUX SHELL parsing JSON format
1. Use tool JQ
https://stedolan.github.io/jq/
Download version Linux version
Jq-linux64
Ubuntu Direct sudo apt-get install JQ can be. 2. Parse JSON
[Root@cas script]# cat Test.json {"Tasks": [{"id":
Introduce a file in a makefile file by using include
Include $ (shell./getname)
and the contents of the GetName are as follows:
pwd=$ (PWD);
if ["${pwd#*/zloader.}" = "$pwd"];then
Echo Makefile.cpci
Else
echo Makefile.${pwd#*/zloader.}
fi
I've
Reprint: http://blog.chinaunix.net/uid-27571599-id-3473078.html
Many people have asked me how to write shell script, how to achieve the same time to upload files to three FTP servers, how to detect the three servers are alive and so on, in fact,
Shell Programming
1. Briefly
The format for writing shell scripts using the vi text Editor is fixed, as follows:
#!/bin/bash
#comments
The symbol in the first line #! tells the system that the program that is specified by the following path
HBase contains a shell that can communicate with HBase. HBase uses the Hadoop file system to store data. All these tasks occur in HDFs. Here are some of the
Common HBase shell commands.
Data Manipulation language
Command
1.1 HBase Command mode
The HBase Shell command provides a TAB key completion instruction.
$ hbase Shell
After entering shell command mode, you can use the HBase shell command to manipulate the data.
Convert an hbase log date ' 08/08/16 20:56:29 '
One, the read command reads the file automatically removes the space before and after the line.
A.txt: (There are spaces before and after each line)
11111
222222
3333333
A.sh:
#!/bin/bash
While Read Oneline;do
echo "$oneline"
Done
Execution
File command to view the properties of *.sh ASCII text with the CRLF line terminators
The line end flags for Linux and Windows text files are different. In Linux, the text file uses "/n" for carriage return, while Windows uses "/r/n" to indicate
In shell scripts, the variables are global by default. So recursive calls require the local keyword to be used to display identity locals so that recursive calls to functions can be implemented. Wrote a recursive calculation of factorial script,
#!/bin/bash # # method 1
A=1234;echo "$a" | [-N "' Sed-n '/^[0-9][0-9]*$/p" "] && echo string A is numbers
The first-n is the shell's test flag, and the subsequent string "' Sed-n '/^[0-9][0-9]*$/p '" is tested, and if not NULL,
Listen to people say that text classification when processing 100G text files, incredibly without big data, processing method is to use the shell split to split into a number of small files.
Split command
NAME split-split a file into pieces
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