Linux Shell Script interview fine selection 25

What is the Q:1 shell script and is it required? A: A shell script is a text file that contains one or more commands. As a system administrator, we often need to use multiple commands to complete a task, and we can add all of these commands in a

Shell break and Continue commands

In the loop, sometimes you need to force out of the loop when the loop end condition is not reached, like most programming languages, the shell also uses break and continue to jump out of the loop.Break commandThe break command allows you to jump

Shell-4.shell double quotes, single quotes, back quotes, backslashes

Shell double quotes, single quotes, back quotes, backslashes single quote ': Disallow reference to other variable values, $ as normal characters. Anti-quote ": Outputs the command execution result1. Double quotes ""• Use double quotation marks to

Anti-DDoS attack shell script

Recently, the server has been frequently attacked by DDoS, so it can only be solved temporarily by IP source. IP is not the source of changeable, light by hand to add is simply a nightmare, think of a method, with the shell to do.Relatively simple,

Shell appears syntax error near unexpected token ' < ' workaround

The latest when looking at a shell data, according to the textbook, but the following error, can not runAs follows, the simple script:#!/bin/bashcat | while Read Line do Echo $line Done awk'{print $}')The following error occurred while

Parentheses in the shell (parentheses, brackets, curly braces)

One, parenthesis, bracket ()1, single parenthesis ()① Command Group. The commands in parentheses will be executed in a new sub-shell sequence, so the variables in parentheses cannot be used by the rest of the script. Multiple commands in parentheses

Shell's date usage

#man date to see the Help file for date#date Get the current time#date-D " -1week" +%y%m%d get last Sunday issue (Day,month,year,hour)#date--date= " -24 hour" +%y%m%d Ibid.date_now= ' date+%s ' shell script to assign variable valuesPercent output%

Advanced Bash-shell Guide (Version 10) study notes three

The script on the book compares the more useful scripts for more recordsA better way to check if the command-line arguments are numberse_wrongargs=85 # non-numerical argument (Bad argument format). The #42 # case "$" in43 # "") lines=50; # *[!0-9]*)

Four arithmetic operations of the Linux shell

There are several ways to do this in Bash's arithmetic operations:Example of name syntaxArithmetic extension $ ((arithmetic)) r=$ ((1+2*3))Use external program expr expr arithmetic r= ' expr 1+2*3 'Use $[] $[arithmetic] r=$[1+2]Using built-in

Linux Shell Custom functions (definition, return value, variable scope) Introduction

Defining shell functions (define function)Grammar: [ function ] funname [()]{ action; [return int;]}说明:1. 可以带function fun() 定义,也可以直接fun() 定义,不带任何参数。2. 参数返回,可以显示加:return 返回,如果不加,将以最后一条命令运行结果,作为返回值。 return后跟数值n(0-255)。 Example (test_fun.sh): #!/

Mac/linux Shell Batch Rename method overview

Overview of methods for batch renaming of Linux shells0. Batch rename with graphics software like Gprename1. Remove all the. Bak suffixes:Rename ' s/\.bak$//' *.bak2. Modify the. jpe file suffix to. jpg:Rename ' s/\.jpe$/\.jpg/' *.jpe3. Change the

"Shell" wildcard characters and special symbols

--from "Brother Bird's Linux private dish"There is also a very useful feature in Bash's operating environment, which is the wildcard character (wildcard)! It's even easier for us to use bash to process data! Below is a list of some common wildcard

Shell Script Auto Install jdk-6u34-linux-x64-rpm.bin skip Enter auto Install

On the code:#!/bin/bash#engine server Install#write by guojr#set Engine server Dirjdk=jdk-6u34-linux-x64-rpm.binchmod o+x $JDK & & Echo-e "\ n" |/$jdk;(cat >/etc /profile;source/etc/profile;Echo-e "\ n" |./$JDK; This is the most critical step. Skip

Shell Scripting Learning 20 shell until loop

The Until loop executes a series of commands until the condition is true. The Until loop and the while loop are just the opposite of the processing mode. The general while loop is better than the until loop, but at some point it is only rare that

Install zabbix-agent using shell scripts

[[Email protected] shell] # Cat zabbix. Sh #! /Bin/bash Set-x Host = 'hostname' Dir =/root Service iptables stop AZ () { Groupadd zabbix Useradd zabbix-G zabbix-S/sbin/nologin Tar-zxvf $ DIR/zabbix-1.8.5.tar.gz CD zabbix-1.8.5 ./Configure -- prefix

Mathematical operations in Shell

Expr command======== At first, the Bourne shell provided a special command to process mathematical expressions. The expr command allows you to process mathematical expressions on the command line, but is particularly clumsy: $ expr 1 + 5 6 The

Shell script telnet login

  #!/bin/bash( echo "user" sleep 2 echo "passwd" sleep 3 echo "do something in remote device" sleep 3 echo "exit") | telnet IP The above is non-interactive usage. If you need interactive usage, you can use round CT, and then

Shell script for formatting the SD card

-------------------- The script is first extended and then formatted. One fat extension and one ext3 Partition ------------------- #! /Bin/sh## Partition and format the SD card script# Usage mksdboot. Sh -- device/dev/SDB Version = "0.1" Execute (){$

Linux Bash Shell Learning (8): shell programming basics-string operations

This article is also the second of the book note in Chapter 4 Basic shell programming of learning the bash shell 3rd edition, but we will not limit it to this. String operation In the following description, ":" Can be deleted. "Yes" means "exist

Shell script programming Selection Control Structure

Shell script programming Selection Control Structure There are two programming languages: interpreted language and compiled language. An interpreted language is an interpreted statement that can be executed on Demand Based on the process control

Total Pages: 541 1 .... 39 40 41 42 43 .... 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.