Linux shell scripting Exercises

One#!/bin/bash#自动添加用户, and make the initial password a user account name, and force the user to change the password when they log onI=1While [$i-le 15]DoIf [$i-le 9]ThenUseradd user0$iecho "User0$i" | passwd--stdin user0$i &>/dev/nullchage-d 0 user0$

Usage of the Linux shell break, continue, exit, return

Break, continue, exit, return are generally used to control the direction of the loopStart with a script descriptionFor ((i=1;iDoIf [$i-eq 3]Then# break# continue# exitFiEcho $iDoneEcho OKResults of the outputResult of break12OkResults of continue124

Unix shell-01 File

There are three methods to access a file:1. Read. The content of this file can be displayed.2. Write, delete or edit the file.3. Run a shell script or program Users of files can be divided into three types:1. File owner, that is, the creator of the

Use shell to check for errors in logs and send emails if any errors occur.

#! /Bin/bash# Initializing Environment VariablesSource. bash_profile# Inherent date format in log nameF_name = 'date + % Y % m % d'# Log path and nameLOG_FILE =/backup/DB/RMAN/log/RMAN $ f_name-0401.logEcho $ LOG_FILE# Counting the number of log

Thoughts on Shell Architecture

It took me several minutes to think about whether or not I should write this article. At last, my reason for being limited was finally succumbed to the Title I have already written, so I am not afraid of you laughing at me.I did not write this

Detailed introduction to basic Linux Shell script Learning (4)

In the previous basic Linux Shell script study, we talked about if, select, and Case of the process in the Linux Shell script. Here we will introduce the loop and quotation marks of the Linux Shell script control process, the control process

Shell script Practice Notes (10)-read the spark cluster script fragments

Preface: Through studying spark cluster scripts, take notes on some important shell script skills. *). Get the directory of the current script sbin=`dirname "$0"` sbin=`cd "$sbin"; pwd` Code comments:# The above code is a common technique for

A good way to learn and understand shell -- write your own shell 2

The simplest form of shell scripts is to list a series of commands. Shell acts as an interpreter and runs them one by one until the last or exits. However, this can only be a simple task. It is only the time when the province and province have to

Differences between login shell and non-Login Shell

Before the introduction, I first thought about a question: Sometimes we fail to enter the user's shell environment after switching the user through the su command. Why? Login Shell:Complete logon process is required when Bash is obtained. That is to

Linux Shell crontab scheduled operation

In Oracle, you can use the dbms_job package to regularly execute PL/SQL and SQL processes. crontab can only be used for scheduled tasks at the operating system level, such as backup. This article describes the specific usage of crontab for memo. In

Learning shell script programming (Issue 1) _ writing and modifying permissions and executing Shell programs

Write shell program Execute shell program Shell programs have many features similar to C and other programming languages, but they are not as complex as programming languages. A shell program is a series of Linux commands and utilities stored in a

Linux Shell hexadecimal conversion

Shell can represent different hexadecimal data without calling the 3rd-party command. The following methods are summarized here. The default value of a shell script is a 10-digit number, which can represent other numeric values unless the number

Setuid on shell scripts

Setuid on shell scripts Running software as root without requiring a root password is the subject of a number of tutorials on the web, and although it may seem a little bit confusing, it's fairly simple. inevitably, users want to run shell scripts

[Erlang 0031] complete output data in Erlang Shell

Someone in the group asked me that the long data in shell was omitted as [...] |...], how to view the omitted part is the problem encountered when calling OS: getenv (). We have encountered similar problems before, such as string: tokens

Linux bash shell Learning (18): string I/O -- ECHO and printf

This article is the seventh chapter of "Learning the bash Shell" 3rd Edition, "Input/Output and Command-Line Processing. Echo Echo is a very common shell command. The parameters are as follows: -E: parses backslash-escaped, a backslash (/n),/t,

Unix shell Learning Series-Tools

This is the first phase of the shell Learning Series and will be constantly updated... Specific Learning books: Unix shell programming (Third edition) This section describes some tools that are frequently used in shell programming.   1. Shell tool --

Function Definition and control statements in shell

1. The Function Definition Format in shell is: Function name (){ # Function body } The function definition must follow the principle first defined in use, such as defining the function print #!/bin/shfunction print(){if [ $# -lt 1 ]then print “no

Use shell scripts to automatically install LINUX

1 case description A company needs to install a centos operating system on a large number of servers. It is time-consuming and labor-intensive to manually install one. Therefore, it is very important to build a PXE Server. the system server is

BASH Shell simple progress bar small function, bashshell

BASH Shell simple progress bar small function, bashshell Not to mention, directly add the script. # processbar processbar() { local current=$1; local total=$2; local maxlen=80; local barlen=66; local perclen=14; local

Shell Command sshpass non-interactive SSH password verification

Shell Command sshpass non-interactive SSH password verification Shell Command sshpass non-interactive SSH password verification # Install sshpasssshpass : Http://sourceforge.net/projects/sshpass/ Download it as a tar.gz compressed package. $

Total Pages: 541 1 .... 136 137 138 139 140 .... 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.