Linux Shell Scripts

1. Write a script that calculates the factorial of 10 using a loop #!/bin/shFactorial=1For a in ' SEQ 1 10 'Dofactorial= ' expr $factorial \* $a 'Doneecho "10! = $factorial "2. Write a script, after the execution, print a line prompt "Please input a

Linux Common Commands (second Edition)--shell application tips

ShellApplication TipsTips:1, command completion function: Key2, clear screen:ctrl+l3. Delete all contents before cursor:ctrl+u4. Command history: HistoricalThen:! History The command label listed, you can execute that command. Such as:! 188Also:

Linux Shell Terminal Chinese garbled

Method One:Modify the/etc/sysconfig/i18n fileChange the lang= "en_US" inside to GB2312.To restart the machine.Without restarting the method, directly# lang= "GB2312"And then we can.Modify i18n just to restart the activeMethod Two:#vi

Shell upgrade,/bin/bash versions 4.1 to 4.3

Bash environment variables have arbitrary code execution vulnerability: "Using CGI requests can cause remote code execution, which in turn leads to server intrusion, causing serious harm,Patches officially announced are also

Zabbix automatically installs the agent (Shell)

#!/bin/bash#./zabbixagent.sh  172.16.103.16   172.16.103.134#$1 master address, $2 local_listen_ip groupadd zabbix  &&  useradd zabbix -g zabbixcat >>/etc/services This article is from the "muzinan technical blog" and is not reposted! Zabbix

Shell scripts convert files from GBK to UTF-8 Encoding

Http://www.jb51.net/article/51308.htm 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 #!/bin/sh    ##  ## convert file from GB2312 to UTF-8 ##    path="$1"unset opt if [ "$2" = "force" ]; then    opt=

Shell Automatic Logon script

#! /Bin/baship = 'awk' {print $1} '/home/bash/mima.txt' For I in $ ipdo {Port = 'grep $ I/home/bash/mima.txt | awk '{print $2} ''pawd = 'grep $ I/home/bash/mima.txt | awk' {print $3}'' CT This article from the "IT technology personal opinion" blog,

Peid off-pecompact shell 0 basic practice

Recently, I sent a peid shell check tool to everyone. Maybe the newbie doesn't know what this is.Let's take a look at its usage.Peid is now the most popular shell check tool. The so-called "shell" is to put a "shield" on the program, which can be

Functions of various parentheses in Shell

When writing shell scripts, brackets and brackets are often used. I. Parentheses, Parentheses () 1. Single parentheses. ① Command Group. The commands in parentheses will open a new sub-shell for sequential execution, so the variables in parentheses

Hadoop shell Operation Command

Shell operation command: HDFS path, defined in core-site.xml fs. Default. Name HDFS: // master. hadoop: 9000 master. hadoop namenode Host Name Use/to replace the current absolute path Hadoop FS-ls/View content in the root directory of

Common shell tools

Awk Awk is a programming language used to process text and data in Linux/Unix. SedSed is a stream editor that is a very useful tool in text processing. GrepGrep is a powerful text search tool, which is often used in combination with pipelines.

Shell scripts used to disassemble and combine various objects in PDF

Disassembling script header_start=0header_len=15xref_start=$(strings -a -t d $1 | grep -e "\bxref\b" | awk ‘{print $1}‘)trailer_start=$(strings -a -t d $1 | grep -e "\btrailer\b" | awk ‘{print $1}‘)#echo $xref_start#echo

Shell Concurrency Control

Method 1: #!/bin/bashc=0for i in `seq -w 18 31`;do while [ $c -ge 3 ];do c=$(jobs -p |wc -w) sleep 1s done bash run_cal_us_tmp.sh 201407$i & #echo "`sleep 5s`haha" & c=$(jobs -p |wc -w)done Advantages: easy to implement Disadvantage: If

Shell removes empty rows

There are many blank lines after extracting the log files to be viewed recently, which is not conducive to the comparison of previous files. In order to be backward compatible, only empty lines can be deleted when obtained. I googled myself and used

Common hbase shell operations based on hbase

General Operation View Server Status status View hbase version version   DDL operations Create a table create ‘member‘,‘member_id‘,‘address‘,‘info‘ Three columns are created: member_id, address, and info. Knowledge Point Review:Cf is a part of the

Shell script for collecting system information

#! /Bin/bashIP = $ (ip A | grep "Inet" | awk '{print $2}' | awk-F/'{print $1}' | grep-V 127.0.0.1 | awk' begin {rs = '\ n'} {$1 = $1; print $0} '| SED's //,/G') # retrieve all IP addresses except 127.0.0.1 and separate them with commas (,).Hostname =

Shell BASICS (II)-shell Variables

1. Define Variables 1) when defining a variable, the variable name does not contain the dollar sign ($), for example:Var = "Hello World"2) Note that there is no space between the variable name and equal sign, which may be different from all

A shell script for batch download of network images

By long Luo Recently Weather ForecastProject, you need to download some weather icons from Yahoo, but because there are many icons, there are more than 80. Icons are stored on the Yahoo image website. Thunder does not support HTTPS download.

Shell upgrade,/bin/bash versions 4.1 to 4.3

Shell upgrade,/bin/bash versions 4.1 to 4.3 Bash environment variables have arbitrary code execution vulnerability: "Using CGI requests can cause remote code execution, which in turn leads to server intrusion, causing serious harm,Patches officially

Linux shell redirection and shell redirection

Linux shell redirection and shell redirection Redirects the shell error output to the standard output to record the error information of the script. For example: /Root/test. sh> test. log 2> & 1 Note: Linux first loads/etc/rc. d/rc. local

Total Pages: 541 1 .... 299 300 301 302 303 .... 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.