2017 the latest enterprise face Test shell (iv)First, the draw script (1) requires the following:1, write a script execution, enter the name, generate a random number 01-99 between the number;2, after entering the name, the screen output information,
2017 the latest enterprise face Test Shell (ii)Exercise 1: write a shell script that lists the IP of the 192.169.5.0/24 network segment online. (Locate the active IP)Requirements are as follows:1. The online IP and the online IP are placed in two
1.1 What is a shell? in computer science, Shell commonly known as Shell , used to distinguish from Kernel ( nucleus ), refers to the "User interface " software ( command parser ). It is similar to DOS command and later cmd.exe. It receives the
sed command file editingsed is a text editing command that reads file data through a terminal into a buffer, then edits text through SED, and in the output to the specified file, sed is a stream editor, which is a very useful tool in text processing,
We can pass parameters to the script when executing the Shell script, and the format of the parameters obtained in the script is:$n. n represents a number, 1 is the first argument to execute the script, 2 is the second argument to execute the script,
Shell Requirements: Write a scriptOne, add 10 users user1 to User10, password with the user name, if the user exists, but requires only the user does not exist in the case can be added, in the format of/useradd.shSolution ideas: 1. Use the FOR Loop
Shell Requirements: Write a scriptOne, add 10 users user1 to User10, password with the user name, if the user exists, but requires only the user does not exist in the case can be added, in the format of/useradd.shSolution ideas: 1. Use the FOR Loop
Put a bunch of commands in the script into executable script execution;Script, file name is. SH, get hostname host nameSystem variables:ENV: View System VariablesSet: All variables can be printed with grep andExport path: Define Global variables
Hello everyone! Today's share is the basic knowledge of some shell scripts, chapter for the introduction of the content of this article are: variables (classification, assignment, query, reference), arithmetic operation implementation.Introduction
Transferred from: http://my.oschina.net/u/189445/blog/595232
HBase shell command
Describe
Alter
Modify Column family (family) mode
Count
Number of rows in the statistics table
Preface or Today write a self-starter packaging script. Used to get the last file name from the path name. Here is a record of the implementation process.Of course, in the end I will also give the official approach. (PS: Very embarrassing, realized
Command editing ability (history):One of the great features of Bash is that "he can remember the commands he used!""This is a really great feature!" Because I just have to press the "up and Down" button in the command line to find the front/rear
Order of 1.Shell Search commandsWhen the shell executes the command, it does not directly look in the path path, but instead looks for the command location in a fixed order. The search order is as follows.1. Aliases. Even if you create a command
Syntax 1:substring=${string:start:len}The subscript of string starts with 0, with start, but the Len character is truncated and assigned to substring1 #!/bin/bash2 #substr =${string: Start:len}3 str=" 123456789 " 4 substr=${str:3:3}5echo $substr6 7
The fourth chapter is about the shell variable knowledge advanced and practice;The fifth chapter is about the numerical calculation practice of variables;The annex includes the source code, please download.The two chapters should pay attention to
Format: Date [options] ... [+ format]Option Description:-D,--date= string displays the time described by the specified stringFormat Description:Example 1:#!/bin/bash##1. Gets the current system time yyyy-mm-DD HH:MM:SSv_time_eq=`Date "+%f%T"'
1. Write more comments in the script This is a recommended practice that can be applied not only in shell scripts, but also in all other types of programming. commenting in a script can help you or others to read your script
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 ()
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.