Requirement: One file displays the content three line as a lineIdea: is the second line of content, the contents of the third row is appended to the first row, so that the contents of three lines can become a row, if not enough three lines
There is demand, can let oneself lazy is the real motive force of study. Because the test environment always needs to manually modify the configuration file after building the code, the learning side completes a shell script that can be modified
Original documents, welcome to read, Forbidden reprint.In the example, the "yes" in the previous line of the finish is changed to "yes"One way to do this is to use Sed+awk together.[Email protected]:~$CatA.txtline0is yesline1is yesline2is yesline3is
Scripting features: Display all disks and select, partition all selected disks, repartition partitions and format file system#!/bin/bash# Display all disks and select, format partition of selected disk, repartition partition and format file
1, Shell Equality comparison note-eq Comparison of numbers equal= = Comparison of string equality2, = = and the difference= = can be used to determine if a variable is equal, = In addition to being used to determine whether a variable is equal, it
Shell for LoopThe syntax for the Shell for loop is as follows for inch List Do command1 command2 ... CommandN DoneExample: for inch {1.. - } do echo $i Done Class C language is also possible for ((i=1; i; i + +)) do
Shell Branch Statement Case inch mode 1) Command1 command2 command3 ; Mode 2) Command1 command2 command3 ;; *) Command1 command2 command3 ;; EsacDescription: After the case is taken, the value is the keyword in,
Reprinted from: http://my.oschina.net/u/1032146/blog/146941What is here Document?Here Document is a special redirection method in the Linux Shell, and its basic form is as followsCMD Here Document ContentDelimiterThe function is to pass the contents
Using Qprocess Qthread============================================#include int main (){Qprocess::execute ("LS");return 0;}============================================
Qprocess *poc = new Qprocess;poc-> Start ("Ping 222.207
$* all positional parameters, being used as a wordNote: "$*" must be referenced by ""[email protected] is synonymous with $*, but each parameter is a separate "" reference string, which means that the parameters are passed completely, are not
$# the number of arguments passed to the script$* Displays all parameters passed to the script in a single string. Unlike positional variables, this option parameter can be more than 9 $$ The current process ID number for the script to run $!
Save a copy of the template, then use it for simple parameter processing#!/bin/Bash whilegetopts h:ms option #选项后面的冒号表示该选项需要参数 Do Case "$option" inchh)Echo "option:h, Value $OPTARG"#参数存在 the $optargEcho "Next arg index: $OPTIND";; m)Echo "option:
Thinking of comparing the shell to a script like Python and Java, I gave up when I had the idea. This is too insulting to the shell. (Crying smiley!) )As a programmer, Linux is the most basic requirement. and the shell script will sometimes show its
Used to write scripts often worried about the big paragraph of the text to My line with "#" to comment, I think the shell is not as smart as C, there are two different ways to annotate. Today I know that I am not smart, I do not see the use of
One or one-D arraysBash supports one-dimensional arrays (which do not support multidimensional arrays) and does not limit the size of arrays.Similar to the C language, the subscript of an array element is numbered starting with 0.Second, define the
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