A simple calculator implemented with a shell

#!/bin/bash#echo "1.$12.$23.$3"If ["$" = "+"]ThenRes= ' expr $ + $ 'echo ">>the result is: $RES"elif ["$" = "-"]ThenRes= ' expr $-$ 'echo ">>the result is: $RES" #这里说明下, using "x" instead of "*" #是因为在命令行输入 *,shell parsing problem, #* cannot be

Shell script for running Java programs under Linux

Vim creates a new shell file, such as my file named Java_run, which reads: echo "Please enter the Java file path you want to compile:" Read Path #分离路径和文件名var1= ' dirname $path ' #路径Var2= ' basename $path ' #文件名CD $var 1Javac $var 2Java ${var2%.*}

How the shell determines that a filename starts with a character ~

Question: How does the shell judge a filename to start with a character ~ Solve: #var = "cn get the length of me" #$1:parameter 1 to judge the name of the file Var=$1 Iscn=false # ${var:0:2} takes the Var substring from the No. 0 character and

The way the Linux shell counts the number of rows __linux

This article refers to the example on the http://www.docin.com/p-56167731.html 1. Statistics of the number of rows of a file can be made with the following command: Grep-c "" Xxx.txt Or Grep-n "" Xxx.txt | Wc-l ___________________________ Ps: Use

On the ">/dev/null 2>&1" of shell

From: http://www.ixdba.net/a/os/linux/2010/0422/35.html "When reprinted, please indicate the source of the article and the author's information and this statement in the form of a hyperlink"Original link: http://www.ixdba.net/a/os/linux/2010/0422/35

Shell script handles text files && space transformation lines line by row

Reference: http://www.cnblogs.com/dwdxdy/archive/2012/07/25/2608816.html Often to the stylistic document for line-by-row processing, in the shell how to obtain each row of data, and then processing the row of data, and finally read the next line of

Shell string Matching

Question: How does the shell judge a filename to start with a character ~ Solve: #var = "cn get the length of me" #$1:parameter 1 to judge the name of the file Var=$1 Iscn=false # ${var:0:2} takes the Var substring from the No. 0 character and

"Shell Learning Notes" Curl Command summary

2014-12-16 20:34, Evans, Hai Hui =========== Curl Command Summary 1. Download Curl-o [FileName] www.baidu.com 2. Display HTTP Request header information Curl-i www.baidu.com Display HTTP response header information Curl-i www.baidu.com 3.

Use expect here Document in shell

When you use a shell to write a program, you sometimes have to confront the problem of interaction--unfortunately, the shell can't automatically complete the interaction. If the interactive content is many, it is convenient to apply expect script

A small calculator compiled with a Linux shell __linux

#!/bin/sh Echo-n "Welcome to I programming World" Echo-n "This program is a calculator" Operator= "+-x/exit" echo "Please input two digits:" Read Number1 number2 Select I in $operator Todo Case $i in +) result=$ (($number 1+ $number 2))

QuickStart Shell Scripting (ii)

Last time I wrote the shell, I found that VI and VIM are different: Vim is the upgrade version of VI, it is not only compatible with all VI directives, but also some new features in it. Vim is much more useful than VI. This time the last content,

tomcat+ Peanut Shell Configuration Web project to achieve extranet access __web

The first step: Download Tomcat 7.0.27 Click the Open link, this is a no-install compression package, decompression can be used. The second step: Apply for dynamic domain name, you can go here to register a peanut shell account, registered well

Use the shell to count the number of occurrences Top10 URLs

#!/bin/sh foo () { If [$#-ne 1]; Then echo "usage:$0 filename"; Exit-1 fi egrep-o "http://[a-za-z0-9." +\. [A-za-z] {2,3} "website | awk ' {count[$0]++} END {printf ("%-30s%s\n", "Wensite", "Count"), for (Ind in count) {printf

Mac Shell Terminal Edit command line shortcut keys

CTRL + A//move to the beginningCtrl+e//Move to end of line===========linux System with ============Alt+a//move to the word header where the cursor is locatedAlt+e//move to the end of the word where the cursor isAlt+d//delete cursor at end of

Shell scan on the same network segment surviving host

This example takes the class C address as an example, if it is a Class A or class B address, the script can be modified slightlyIpaddr= '/usr/sbin/ip a | grep $1 | grep inet | awk  ' {print  $2} ' netmask= ' echo ${ipaddr} | awk -f  '/'   ' {print $2

Shell Script Exercise II

Print 99 multiplication table#for Statement Format#!/bin/bashfor ((a = 1; a Dofor ((b=1; bDoLet Sum=b*aEcho-ne "$a * $b = $sum \ t"Doneecho ""Done#while Statement Format#!/bin/bashA=1While [$a-le 9]DoB=1While [$b-le $a]DoLet sum= $a * $bEcho-ne

There are two ways to run a Shell script:

1. As an executable programSave the above code as test.sh and CD to the appropriate directory:+./test. #使脚本具有执行权限./test. #执行脚本 Note, be sure to write ./test.sh, not test.sh, run other binary programs also, the direct write Test.sh,linux

Sublime calling the shell

When you do Flask Web development under Linux, you begin to fully learn to use the sublime editor.Because of the need to shell execute the command under python run.py runserver , it is necessary to be able to invoke the shell execution of the

Use the shell to intercept a specified timestamp log to another file

1, using the shell to intercept log logs for a period of time can use the SED command to extract the log file:The command is as follows:#sed-n '/1531324800/, $p '/data/log/mosquitto/mosquitto.log >> log.log"1531324800": This is the start timestamp,

Shell Programming Specifications and variables

Concept:The commands that will be executed are saved sequentially to a text file, which can be run by giving the file an executable permission.The composition of the shell script:1) Script statement: The script declaration indicates which

Total Pages: 541 1 .... 286 287 288 289 290 .... 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.