Linux Experiment 3,shell Programming

Source: Internet
Author: User
Tags time limit

/ETC/PASSWD Purpose: This directory stores the operating system user information, which is visible to all users. Consists of 6 semicolons consisting of 7 information, user name, password (encrypted), UID (user ID), GID Group ID, user's full name or local account, start directory, login using the shell is the tool to parse the login command

/etc/shadow: A total of 9, respectively: account name, password, the date of the latest change of password, the number of days the password needs to be changed, the password needs to change the period before the warning period, password expiration time limit, account expiration date, retention

/etc/group: Group name, password, group identification number, list of users in the group

/etc/gshadow: Group name, password, group manager, user list within group

The ID command can display a real and valid user ID and group ID, and if two IDs are the same, only the actual ID is displayed, and if only the user name is specified, the current user ID is displayed

Id-u: Print user-Valid ID only

About the usage and differences of Which,where is,find,locate:

Which: View the location of the executable file

Whereis: Viewing the location of a file

Locate: View file location with database

Find: Actual search hard Drive query file name

The gzip command is used to compress the file, which is a widely used compression program, after which the file is compressed, and its name is followed by more. GZ extension

。。。

Compare two numbers for equality

(1) Editing the program with VI

[[email protected] bin] #vi test7

#! /bin/bash

Read X, y

if test $x –eq $y

Then

echo "$x = $y"

Else

echo "$x! = $y"

Fi

(2) Set permissions

[[email protected] bin] #chmod +x test7

(3) Implementation

[Email protected] bin]#./TEST7

50 100

50!=100

[Email protected] bin]#./TEST7

150 150

150= =150

Assign values to two character variables, one variable to a certain value, the other variable to be empty, and the other to manipulate.

(1) Editing the program with VI

[[email protected] bin] #vi Test8

#! /bin/bash

Part1 = "1111"

Part2 = "" #part2为空

["$ part1" –a "$ part2"]

echo $? #保存前一个命令的返回码

["$ part1" –o "$ part2"]

echo $?

(2) Set permissions

[[email protected] bin] #chmod +x test8

(3) Implementation

[Email protected] bin]#./TEST8

1

0

Shell Advantages:

Shell is simple and flexible, it is very helpful for the automation management of Linux system, it can make the work of system administrator easy, simple and efficient. Shell scripts can be ported flexibly in UNIX and Linux systems. Shell scripts make it easy to get and modify the source code without compiling.

The shell is used in many places in Linux and is familiar with shell commands that can help solve some of the problems.

Disadvantages:

When considering efficiency, such as the requirements of some algorithms, the shell is seldom used. For example, some complex arithmetic operations, generally use other programming languages.

Complex programming requirements.

Tasks that require relatively high security.

Large-scale file operations.

Multidimensional array support.

Data structure support.

Graphical interface.

Direct system hardware operation.

I/O or socket interface.

Use to libraries or interfaces.

Private purpose.

For Python for machine learning, design algorithms. or design scripting languages are all possible, Python's biggest advantage is that the code is simple.

Like Matlab and R languages are more suitable for some computational processing. Java has a good application in Jsp,android,hadoop and so on, C is a relatively low-level language, for some of the underlying development and in-depth application can be given priority.

Linux Experiment 3,shell Programming

Related Article

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.