8 useful shell-script sharing

This article mainly introduced 8 practical shell script sharing, this article has given the judgment input number character, the character or other, asks the average, the self decrement output, adds the prefix in the file, the batch test file

Shell scripts periodically empty log files larger than 1G

This article mainly introduces the shell script to empty more than 1G log files, this article directly gives the implementation code, the need for friends can refer to the following A question about how to automatically delete a specified file

A basic Bash shell command (based on Ubuntu implementation)

A basic Bash shell command (based on Ubuntu implementation) The/etc/passwd file contains a list of all system user accounts and basic configuration information for each user. Man commandEnter the man command before the name of the tool you want to

Linux,shell script, font color and settings

Shell echo display in script with color display , echo display with color, need to use parameter- e The format is as follows: echo-e "\033[ word background color; text color m string \033[0m"   For example:echo-e "\033[41;36msomething here \033[0m"  

Logical judgments in shell scripts

Logical judgments in shell scriptsIf logic is judged. The basic syntax for if judgment in the shell is:1) without ElseIf judgment statement; then COMMANDFIFor example:[email protected] sbin]# cat if1.sh#! /bin/bashread-p "Please input your score:

The while loop of the shell loop structure

While loop1)While CONDITION; DoStatementStatementDoneWrite a script that calculates 1---100 of the AND#!/bin/bash#Sum=0I=1While [$i-le 100]; DoLet sum= $sum + $iLet i= $i +1DoneEcho $sum2)While true; DoStatementStatementDone#!/bin/bash#While true;

Set command detail: On, turn off Shell feature properties

Set is a shell internal command to turn shell feature properties on or off, and if nothing is added, the user-defined variables and environment variables are displayed directlySyntax: Set [Options ...]Options:- F : Disable wildcard characters+f :

Linux Shell Exercise Training

Shell Exercise Training Sum of 2 numbers Calculates the 1-100 and Change the extension of all files in a directory to Bak Compile all. c files in the current directory: Print root can use the number of executable files to process the

Iv. Shell Programming Exercises (1-20)

1. Write a scriptThe script can accept more than one file path as a parameter;Displays the number of rows held by each file;Shows how many files have been executed for the number of rows this time.#!/bin/bashfor file in $*; Do lines= ' wc-l $file |

Tips for bad interpreter:no such file or directory when executing shell scripts

Symptom: In terminal direct Cd/var normal, execute in shell script is error. The reason is that the script is written under the Windows platform, and the line break is different from Linux, causing the script to not execute correctlyThe cause of bad

Shell--9, Shell functions

The Linux shell can be user-defined functions and can be called casually in shell scripts.The functions in the shell are defined in the following format:[Function] funname [()]{action; [return int;]}Description 1, can be with function fun ()

6.1 Shell Programming 4

6.1Given a user, determine if its UID and GID are the same "^ $USERNAME \>" (first word at the beginning of the line)If it does, the user is displayed as "good guy";#!/bin/bash#USERNAME =user1If!grep "^ $USERNAME \>"/etc/passwd &>/dev/null;then user

Shell implementation checks for memory alarms

Use the shell implementation to check the memory size, if it is displayed within the set value, send an email alert Configure Outgoing Mail firstVi/etc/mail.rcAdd the following information # for Linux and BSD, this should is Set.set

How to solve the Chinese garbled character of SSH Secure Shell Client

Http://www.cnblogs.com/52linux/archive/2012/03/24/2415082.htmlScenario One: Modify environment variables for Linux serversWith Linux, there is a. bash_profile configuration file under the user root, which is only valid for the current user. Modify

Crontab let Linux execute shell scripts at timed intervals

With Crontab you can execute a shell script or a series of Linux commands at a specified time. For example, the system administrator schedules a backup task to run every dayEntry# crontab–eThis allows you to open your personal crontab profile in

(Linux shell) Chapter II-The Joy of command (i)

Article from my personal blog: (Linux shell) Chapter II-The Joy of command (a)In the previous chapter, we described some of the syntax that some Linux shells need to be aware of. Next we begin to understand the frequently used commands of the Linux

Shell Scripting Exercises

1, write a script to complete the following functions(1) Pass a disk device file path to the script to determine whether the device exists;(2) If present, displays all the partition information on this device;#!/bin/bash## finddev.sh# pass a disk

Linux network configuration and SSH and Shell basics

Linux network configuration and SSH and Shell basicsFirst, the Linux network configuration The ifconfig command is used to configure and display network parameters for network interfaces in the Linux kernel. The NIC information configured with the

Array of advanced shell programming

Arrays ArrayVariables: Storing the memory space of a single elementArray: A contiguous memory space that stores multiple elements, which is equivalent to a collection of multiple variables that support sparse formatting, which is a discontinuous

Shell directives in Windows 10

This article does not have the technical content, also not big on, but think, still write down, certainly someone will use to get.Often play system friends, should know the Shell instructions, this is a very fun and magical instructions. With it,

Total Pages: 541 1 .... 115 116 117 118 119 .... 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.