Shell Review notes----User management

Source: Internet
Author: User

$ who can know how many landings on the system

$who |wc-l count the number of users

Note: | is a pipe symbol that can be used to establish a pipeline between two programs (pipeline): The WHO output, a WC input, the result of the WC is the number of users who have logged in

Turn the pipeline into a stand-alone command by entering the command into a generic file, and then using chmod to set the permissions for the file to execute.

#! /bin/sh when the first two characters in a file are #!, the kernel scans the rest of the line to see if there is a full path that can be used to perform the interpretation of the program. The kernel will refer to the interpreter with a straight-muttering option, and then with the rest of the command line. Shell scripts are usually #! at first. /bin/sh.

$cat > Nusers creating files, using the input of the cat copy terminal

Contents of the Who |cw-l program

^d ctrl-d says End-of-file

$chmod +x nusers Let the file have permission to execute

$./nusers performing Tests

6 possible test results for output

Shell Review notes----User management

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.