Linux Shell if [n] Use method correctly __linux

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

Reasons for shell scripts not using source in ubuntu12.04 and solutions

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 Linux shell gets the process ID, or gets the process in the application Id__linux

1, the Linux shell to get the process ID method: ps-a |grep "/usr/sbin/gps_app" | awk ' {if ($ = = ' start ') {print}} 'Pidof "CmdName" Pgrep "CmdName" The results of these three kinds of operations in bash and BusyBox ash are slightly different,

Java invokes the shell command under Linux and returns the result as a stream __web

This article writes that Java invokes the Linux shell command and returns the result as a stream. The following is directly on the code, the code is annotated. Very plain and easy to understand. Import Java.io.BufferedReader; Import java.io.

Linux Automatic backup shell (using full backup, incremental backup strategy) __linux

ZZ http://www.cnblogs.com/coffee_cn/archive/2010/03/26/1697038.html Set in Cron, perform every Monday 2 o'clock in the morning (full backup every Monday, incremental backup for the rest of the time) #vi backup.sh #!/bin/bash #

Linux shell Programming Notes-shell input and output -2-read-cat-pipe _ block chain

1. Read command The read command reads information through a keyboard or a line of text in a file and assigns a value to a variable. 1.1, read reading the keyboard data, the input of the content before the return of the data assigned to a variable:

HBase Scan Shell Operation detailed

Creating a table Create ' test1 ', ' lf ', ' SF ' Lf:column family of LONG values (binary value)--Sf:column family of STRING values imports According to put ' test1 ', ' user1|ts1 ', ' sf:c1 ', ' sku1 ' put ' test1 ', ' user1|ts2 ', ' sf:c1 ', '

Arrays and traversal __linux in the Linux shell

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,

Shell for Learning

#!/bin/bash for_1 () { echo ' for 1 show item ' for var in item1 item2 ... itemn do Echo ${var}; Done } for_2 () { echo ' for 2 show 1~5 ' for loop in 1 2 3 4 5 do echo ' The value is: ${loop} '

Linux enables fast switching between JDK versions via shell scripts __linux

"Lead" on the Android website, the installation part of the JDK has the following requirements: The Master branch of Android in the Android Open source project (AOSP) needs to use Java 8, and OpenJDK is needed in Ubuntu. For a lower version, refer

Shell get file suffix

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

Writing shell programs on Linux and executing __linux

to write a shell program in Linux and perform the steps Brief Introduction I am the first time to write a blog, do not know what should be the format and precautions, please advise. Today is about how to create a script and run it in a Linux

Batch execution of the same command shell script on a Linux cluster __linux

Execute the same command on multiple machines on a cluster because of actual development needs. For example, execute a specified script, delete files in the same directory (this is prudent ~ ~) and so on, the members of the group developed a ALLSCP (

Methods for reading file contents in Linux shell scripts (including efficiency testing) __linux

This paper mainly introduces the 4 methods of the shell reading files by line: While loop method, redirect method, pipeline method, file descriptor method. method 1:while The most efficient and commonly used method in the loop. The code is as

awk and Shell pass value to each other

Using variables from the shell in awk One: "' $var '" In this way, you don't have to change the habit of using the AWK program, which is commonly used by foreigners. Such as: var= "Test" awk ' begin{print ' $var ' "} ' This notation is actually a

Shell getopt Usage

Options for UNIX types: UNIX has the advantage that standard UNIX commands have the same command-line format at execution time: command-options parameters if the shell is executed in the same format, the Bourne shell provides a A statement that

Problems with garbled shell script editing

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

Operator of the shell script (iv)

operator!/bin/bash #基本运算符 val= ' expr 2 + 2 ' echo ' two number of sum for ${val} ' #算数运算符 #* required backslash a=10 b=20 val= ' expr ${a} + ${b} ' echo ' A + b = ${val} "val= ' expr $a-$b ' echo ' A-B: $val ' val= ' expr $a \* $b ' echo ' A *:

Shell determines whether a string is a number

#!/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,

Multi-conditional Process Control for Shell if

h=$ (date +%h) s=$ (date +%s) m=$ (date +%m) if [$h = = && $m = = && $s = = 10]] A. bash [] single and double brackets Basic elements:O [] Two symbols should be separated by a space aroundO There is a space between the internal operator and the

Total Pages: 541 1 .... 284 285 286 287 288 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.