101 shell script guessing number game code _linux shell

The original book This example is to teach debugging script, it deliberately gave a few errors in the script, teach us to understand the system prompts the error, and modify the run. But it's more difficult to write, so put the modified script up,

Shell script conditional control and loop statement _linux Shell

Conditional judgment: If statement Syntax format: If [expression] then Statement (s) to was executed if expression is true fi Note: There must be a space between the expression and the square brackets ([]), otherwise there will be a

Shell script Programming Loop statement _linux Shell

It is common to repeat a series of commands while running a script, when we need to use a loop statement to do this. One, for command Format: for variable in list; Circulation body Done The for command traverses each value in the list and exits

The Select command in the Bash shell simply uses the example _linux shell

Objectivetoday I just wrote an automated packaging script, again using the bash shell, a good feeling of happiness. The main point here is to introduce the Select command, which can help us complete the menu selection function. FormatI am also the

VPS Automatic Backup Database to FTP script code _linux Shell

vps

1 Ensure that you are in the home directory (if not, run: cd/home)2 New Backup folder (command: mkdir backup)3) New Script backup.shVI backup.sh Copy the following code (after replication: wq! to save): Copy Code code as follows: #!/bin/

Shell basic calculation, logical operation, bit operation detailed _linux shell

Provides an operational expression in the following format: $ ((expression)) $ echo $ ((5* (3+3)) 30 $ result = $ (($myvar-10)) The shell provides a convenient number of conversions between: $ echo $ ((013)) #八进制 $ echo $ ((0xa4)) #十六进制 You can

Backup shell script instance code _linux shell

1, backup_run.sh Copy Code code as follows: #!/bin/sh # Backup_run # script to run the backups # loads in a setting file for the ' user to ' change Source=/home/bob/backup.defaults Check_source () { # Check_source # Can we load

Shell script creates test data for a specified size file _linux shell

When we are testing or commissioning, sometimes you need to generate a file of size, for example, when testing the storage system, you need to reduce the amount of disk space 5G, the easiest way is to copy a 5G file over, but where to get the size

SVN-based Code submission statistics tool implemented by shell script _linux Shell

svn

Nothing recently, I wrote a code statistics gadget based on SVN in bash. You can specify a catalog of statistics, and the default recursive statistics subdirectory. Currently, there is no capability to mask the specified directory. The code is

A detailed explanation of the variable types in the Linux bash Shell _linux Shell

In the Linux system for day-to-day operations or scripting, variables are more familiar with, but what are the types of variables, what is the difference in the specific usage? This paper is to share with you: One, bash variable type: Local

Shell script implementation to determine whether the IP address in an IP segment code sharing _linux Shell

Cat ipcalc.sh #!/bin/bash ip=$1 If [-Z $IP] then echo-e "\e[31;42m sh ipcalc.sh IP \e[0m" exit fi while read MASK do min= '/usr/bin/ipcalc $MASK |awk '/hostmin:/{print $} ' max= '/usr/bin/ Ipcalc $MASK |awk '/hostmax:/{print $} ' min= ' echo $min

4 ways to execute a shell script and the difference introduction _linux shell

There are several ways to execute a shell script 1, relative path mode, need to first CD to script path Copy Code code as follows: [Root@banking tmp]# Cd/tmp [Root@banking tmp]#./ceshi.sh Script execution succeeded 2.

3 ways to judge variables as numbers in a shell script _linux shell

Method 1: Add a variable to an integer value by using expr, or an integer if it is performed correctly, or an error is executed, $? will be a value that is non 0 Copy Code code as follows: Expr $args + 0 &>/dev/null Method 2

Shell implementation of Iptables management script sharing _linux Shell

The previous script is in save mode, now attach the command to a file, so that it can be easily modified two times or somethingThe script is basically like this, we can change with their situation again ~ add function or something.

Shell script implementation of guessing number games _linux shell

The generated password and user input can accept duplicate numbers.So the relative general rule of guessing numbers may be much more difficult. This version of the rule: a--numbers are right, position is right.b--excludes the result of a, the

Create a daemon code instance in a template _linux shell

Copy Code code as follows: #include "Wrap.h" #define MYDOMAIN_FLAG "/tmp/.mydomain_log" void Domain_end () {Unlink (Mydomain_flag);} int Domain_init () {int FD;Fd=open (mydomain_flag,o_rdwr| O_creat| o_excl| O_APPEND,0600);if (fd==-1)Err_

CPU clock Prefetch instance code share _linux shell

Test the effect of prefetching, using the CPU to always view the effect. According to the experiment found that the prefetch address in the address before the use of the 10 lines around the code at the effect is better! Copy Code code as

Linux multithreaded Programming tutorial (thread through the semaphore to achieve communication code) _linux Shell

Thread classification Threads can be divided into user-level threads and core-level threads according to their dispatchers. (1) user-level threadsThe user-level thread mainly solves the problem of context switching, and its scheduling algorithm

Shell Script Landscaping Login Interface decoration chart (including lunar calendar) _linux shell

Today colleagues idle, asked me to help in the Linux login page to add something he thinks is very unique, look at his hair, said to him is very silent, below to see. Script 1: Cat clcal.sh #!/bin/bash # show Chinese lunisolar calender. # 2011

Get shell script share _linux Shell in directory of the shell script itself

A few days ago wrote seven bull demo, with Bash wrote a convenient installation of the script, involving the path-related judgments, from StackOverflow, plus their own practice to tidy up. Simple version The following is one of the simplest

Total Pages: 541 1 .... 167 168 169 170 171 .... 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.