In the actual work, the shell script needs to be tested for correctness.How to test in the quickest and most effective way?A lot of development habits are, apart, write/Get, run a, see input, output, want to do the operation is completed, also
redirect$echo "Test Redirect" > Temp.txt--Writes the output to the Temp.txt,temp.txt file is first emptied.$echo "Test redirect Second" > Temp.txt-Append the output to the temp.txt.File descriptor0--stdin Standard Input1--stdout Standard
Shell Simple UnderstandingView the current SHELL echo $SHELLTry the first little script: Vim test.sh1 #!/bin/bash2 echo ' I'll be-back ';Note: #!/bin/bash This sentence is bound to add, remember. How to execute the script:1. Give execute permission,
1. REDIRECT standard output (stdout) and standard error output (STDERR) to two different files respectivelywhere the symbol ' > ' defaults to the standard output redirection, meaning and ' 1> ' the same, ' 2> ' indicates a redirect standard error
package.sh #!/bin/bashfor i in ' cat $ ' do echo $i >> resultdpkg-l | grep $i | Sed-n 1p > Tmp//awk read out all the data after the fifth column awk ' {for (i=5;i> result//the error content of the script Directed to a file in sudo dpkg--purge $i >>
1) Why is it called a shell?From the user's point of view, the user is not able to directly manipulate the kernel, but through the kernel "shell" program, known as the shell, to communicate with kernel.1 different operating systems use different
In Qt, you often invoke external commands or execute shell scripts, and you want to analyze the execution results.Qprocess runshellprocess =new qprocess (this); // Monitoring of invoking process outputs This , SLOT (Readprocess ())); Connect (
Which language is most helpful to you in your daily work? I think it's a non-shell. The earliest contact with the shell should be in college, such as the Linux file system cut will use some commands, such as Find, tar, Xargs, CP and so on, and put
This morning a friend suddenly QQ asked, shell programming function why return can only be an integer, how to return the execution of the function and save to a variable. In fact, this problem is very good to solve---only need to seriously
#!/bin/bashcd= ' df-l |awk ' nr==3 {print $4} ' |awk ' BEGIN {fieldwidths= ' 2 1 "} ' {print '} 'If [$CD-ge 20];thenecho " hard disk space is full and cannot be backed up " | Mutt-s " backup alarm, please replace the hard drive in time " [Email
1. Use your favorite editor to tap the command
command
After the command has been knocked out, press , will open an editor you specify (such as Vim, through the environment variable $editor specified), which is the
1. First, log on to the remote Linux server, such as 192.168.127.222, with the normal password login method;2. Click the Key Generation Wizard in the tool:650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/67/wKioL1YcmyPy22e-AAI3RPggo2A573
Http://blog.sina.com.cn/s/blog_a56ef5490101cn58.htmlSed 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
Enterprise Face question 1:Use the For loop to create a batch of 10 files in the/oldboy directory, with the name in turn:Oldboy-1Oldboy-2Oldboy-3......Oldboy-10Hint: In the future to test everyone file prefix is also random, the end is a number
Introduction to Linux file system and Shell file system Ext2/ext3/ext4EXT2 is the standard file system in the Gnu/linux system. This is the most used file system in Linux, which is designed specifically for Linux, with extremely fast speeds and
1. Integer comparison
-eq equals, such as:if [ "$a"-eq " $b"]
-ne not equal to, such as:if [ "$a"-ne " $b"]
-GT greater than, such as:if [ "$a"-gt " $b"]
-ge greater than equals, such as:if [ "$a"-ge " $b"]
-lt less than, such as:
Transfer from http://www.cnblogs.com/dwdxdy/archive/2012/07/25/2608816.htmlThe style files are often processed on a line-by-row basis, how to get each row of data in the shell, then process the row data, and finally read the next row of data, loop
For C in a B C D E F g;do echo $c; Done sequentially outputFor C in a B C D E F g;do tar czvf install.log. $c. tar.gz Install.log; DoneFor C in {a.. g}; do echo $c; Done the same as aboveSeq 1 10 columns of numbersFor i in {1..10}; do echo $i;
Variable setting rules:Variable names can consist of letters, underscores, and numbers, but cannot start with a number.The default type of a variable in bash is a string type, and if a numeric operation is required, specify the variable type as
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.