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
CentOS Shell Basics 2015-4-8 12th SessionThe first half of the classThe second half of the classHistory: Command history, save 1000 commands by default!! : Previous command!$: Last parameter of previous command!n: Executes the nth command in the
Write a script that calculates all the odd and all the even numbers within 100 and displays them separately#! /bin/bashSum1=0For i in ' SEQ 1 2 100 'Dosum1=$[$sum 1+ $i]Doneecho $sum 1Sum2=0For j in ' SEQ 2 2 100 'Dosum2=$[$sum $j]DoneEcho $sum
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
(1) Write a script: If a path does not exist, it is created as a directory, otherwise it is present, and the content type is displayed#!/bin/bash#if [$#-lt 1]; Then echo "Plz Enter a path:" Exit 1fi if [-e $]; Then file $1else mkdir-p $1fi ~Test
This is the weekend when you want to put out the shell, the results, Saturday overtime, plus the class and friends out to play, Sunday and stole a lazy, the results of the weekend did not do anything, with the development of the boss said the
1 , describes the operation principle of shell program (can be attached with necessary graphical description);What is a shell?The shell acts as the shell of the operating system, providing the user with an interface to use the operating system. It
#!/bin/bash# defines greatest common divisor and the minimum number of conventions gcd_result= "lcm_result=" "#定义一个相加的函数function sum () { result=$ ( num1+num2 ) echo -e "\033[31m two number of $result \033[0m"}# Define a greatest common
The shell is also called the command line interface, which is the interface between the user and the computer under the *nix operating system. The word shell refers to the program in the operating system that provides access to the kernel
List The 10 shells you use mostHistory | awk ' {a[$2]++}end{for (i in a) {print a[i] "i}} ' | Sort-rn | HeadHistory | awk ' {a[$4]++}end{for (i in a) {print a[$i] " " i}} ' | sort-rn | headgrep-v "#". Bash_history |awk ' {++a[$1]}end{for
Too lazy, these days seem to have been lazy cancer, do not want to write a blog. Later think about, knowledge, or share the good. The first to cure their own lazy cancer; second, consolidate your knowledge by the way.
There are two types of
Due to the limited time, I wrote this blog for a maximum of 30 minutes. Only as a study note, the content will be as clear as possible. If you don't know what to say, you can hit me!
Joke opened, formally began today's study.Some of the
Use df-tph to view hard disk usage under Linux:sdua:/# Df-tphfilesystem Type Size used Avail use% mounted On/dev/vda3 ext3 2.0G 974M 940M 51%/udev tmpfs 16G 500K 16G
The Magical magic of awk:Extract the number 600 and note the special effect of the + sign.echo "Fuck 600ms" |awk ' {print + $NF} 'Result: Other characters are filtered, leaving only the number 600Using If,for in Commad mode#测试ifa=200if [$a = =];then
Reference: http://www.cnblogs.com/chengmo/archive/2010/09/30/1839632.htmlCreate an arrayA= (12345)Get array length${#a [@]} #${#变量} to get variable length ${#a [*]}Print array ContentsEcho ${a[@]} #echo $a print only the first element of the
Switch from Linux shell array creation and usage tipsThe Linux shell is much more powerful in programming than Windows batch processing, both in loops and operations. Data types are not comparable. Here's a summary of some of the things that an
PackageCom.edu.hpu.sort.insert.shell;Importjava.util.Arrays;ImportCom.edu.hpu.sort.Sort; Public classShellsortextendsSort {@Override Public int[] Dosort (int[] arr) { intLen =arr.length; //all step probabilities (for the first half of 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