Shell Numeric operations

Shell arithmetic operation addition Note! ' 4 ' + ' 5 ' between these three should have blank r= ' expr 4 + 5 ' echo $rr =$[4 + 5]echo $rr =$ ((4 + 5)) echo $r multiplication r= ' expr 4 \* 5 ' r=$ ((4 * 5)) r=$[4 * 5]echo $r Division r= ' Expr 40/5

Shell Common Commands

LS-LH //view file sizeLS-LH filename //View the actual size of a filedu-h //Viewing the size of a file as a diskdu-h filename //View the size of a fileThat LS looks at the actual size of the file, Du is looking at the size of the disk blockDu

Linux Shell 01 Scripts and variables

Creation and execution of a script1. Create file *.sh, file suffix sh2. Editing scriptsThe first line must be: #!/bin/bash #指定解释脚本的shell3. Empoweringchmod u+x a.sh4. Implementation./a.shVariables in the two shell scripts1. Definition and deletion of

Shell tips modification Suffix and grep

Batch modify file suffixThe first type:#!/bin/bashfor fn in *.$1domv $fn ${fn%$1}$2doneThe second type:Find. -name "*.txt" | Awk-f ' [./]+ ' {print $} ' | Xargs-i-T mv {}.txt {}.shGREP User TipsThe file is as follows:# cat Test.txt This was a test

Shell that checks the system IP address and network card rate

The code is as follows:#ac = ' ifconfig -a | grep encap | awk  ' {print $1} ' ac= ' ifconfig |  grep encap | awk  ' {print $1} ' for i in  $acdo          if [  $i  ==  "Lo"  ];then         echo  $i         ifconfig  $i  |  grep  "inet addr"  | sed  '

Shell scripts in Linux automatically enter passwords

The most recent thing about egg aches is that you need to get root in the shell script, so you need to enter a password when the shell script is running.Lazy I certainly want to let the shell in the execution process can automatically enter the

Batch build Linux users with shell scripts

Implementation requirements: Create user student1 to Student50, specify Group as student group! And each user needs to set a different password! The script is implemented as follows:#!/bin/bashfor i in ' seq 1 "do useradd-g student student$i; echo

"Shell" variable

Variable settings:~/dos # dfs=2 Variable use:You can read it using EHCO, but you need to precede the variable name with $, or the ${variable}.~/dos # echo $dfs 2 ~/dos # echo ${dfs}

Shell various scripts

#批量修改当前目录下的文件扩展名, change. doc to. txt1. [email protected] rendir]# vim. /renfilex.sh2. #!/bin/bash3. For FILE in "$"4. Do5. mv $FILE ${file%$1} "$"6. Done++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Write a

Shell script structure and execution methods

[[email protected] ~]# mkdir shell[[email protected] ~]# cd shell/[[ email protected] shell]# vim first.sh#!/bin/bash                                 must be # #the  first test shell script.             Description # #written  by guozhen.mkdir 123   

Shell Debugging Method Summary

For tired print and Echo, try a little bit of fresh effort.1. Using the shell's execution optionsThe common execution directives for SH and bash are:-N,-X,-C,-V.which-N is a shorthand for noexec, which is to do only the syntax checking of the script

Shell Remote Execution command

SSH Main parameter description-L Specify Login user-P Set Port number-F run in the background, and recommended with the-n parameter-n redirects standard input to/dev/null to prevent reading standard input-N Do not execute remote command, only port

Write a simple shell command line

When you create a child process with fork (), you execute the same program as the parent process (but it is possible to execute a different code branch), and the child process often calls one of the exec functions to execute another program.Process

Use of variables in the shell (2)

Some knowledge of variables in the shell:Variable:1. By default, all variables are considered to be stored as strings.2. Variable case sensitivity3. Add $ to the variable name before accessing the content4. No declaration required5. The $ extension

Shell script implementation detects palindrome strings

The structural characteristics of the all-back text are as follows:Assuming that the number of characters is even, it is structurally represented as a sequence of characters with the same character but with the opposite sequence of

Special symbols in the shell

* Wildcard character (* for 0 or more arbitrary characters)[[email protected] ~]# ls *.txtA.txt1. txt:2. txt:? Represents only one arbitrary character[email protected] ~]# Touch Testa[[email protected] ~]# touch Testb.txt[[email protected] ~]# ls-d

Reproduced shell Command 73 article

1. Check if the remote port is open for bash: echo >/dev/tcp/8.8.8.8/53 && echo "open" 2. Turn the process into the background: Ctrl + z 3. Transfer the process to the foreground: fg 4. Generates a random

To talk about efficiency in the shell.

There's nothing going on today. A lot of operations in the shell about efficiency issuesNo, nothing else, no use.It's just something to do.At first, that's the arithmetic.What I recommend here is to use the $ (()) method for simple

Interview questions---various sorts. Insertion, selection, bubbling, shell, heap, quick row

#include #include #include using namespace std;void swap (int a[], int i, int j); void Insert_sort (int a[], int n) {for (int i = 1; i =inc&&temp 0; i--) {for (int j = 1; j i; j--) {if (A[j] = r) {return;} int middle = (L + R)/2;merge_sort (A, L,

Simple shelling Tutorial Note (---hand off exe32pack shell

This note is for the early ximo of the shelling Basic video tutorial, organized notes. the tools used in this note:http://download.csdn.net/detail/obuyiseng/9466056Exe32pack1.ESP Law1, the program loaded into the OD, found that there is a large

Total Pages: 541 1 .... 428 429 430 431 432 .... 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.