2016-5-15 Linux Basic Learning--case statement

Source: Internet
Author: User
Tags case statement

File system access list
Facl: Saving control permissions with file extensions
Permission Application order: Ower->group->other
Ower->facl in User->group->facl in Group->other
Setfacl
-M: Set
U:uid:perm Setting Owner
G:gid:perm set Genus
Eg:setfacl-m U:HADOOP:RW Set Read and Write permissions to Hadoop users
-X: Cancel
U:uid:perm Cancellation of Owner
G:gid:perm cancellation of genus Group
Getfacl:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/1F/wKiom1c4UlLTOn3jAABY0dyamtk577.png "title=" Facl1.png "alt=" Wkiom1c4ullton3jaaby0dyamtk577.png "/>
W.H.O.: Shows which users are currently logged on
Who-h: Display Head
Sleep
Every 5 seconds, check to see if Hadoop is logged in, sign in, show that it is logged in, and exit
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/80/1C/wKioL1c4U0nz0GEBAAAk4-0Ju7o098.png "title=" Who- H.png "alt=" Wkiol1c4u0nz0gebaaak4-0ju7o098.png "/>

WhoAmI: Displays the currently logged on user     
last : Display /var/log/wtmp file showing user login history and System restart history
    -n #: Show information about recent # times
lastb: /var/log/wtmp file, Display user error logon attempts
Lastlog: Displays information about the most recent successful login for each user
    -u USERNAME: Displays recent login information for a specific user

basename : Take a file/path base name (file name itself)
    $0: Script path and name when executing script
    
    eg: Cat/etc/fstab | Mail-s "How is it?" Root
     Second, mail "Recipient < file path
    eg:mail-s" How old is yo U? "Root </etc/fstab
    

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/1C/wKioL1c4U5uQaZUgAAEGV0J2_lk945.png "style=" float: none; "title=" Mail1.png "alt=" Wkiol1c4u5uqazugaaegv0j2_lk945.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/80/1F/wKiom1c4UriAINsRAAD3YVO3dKY594.png "style=" float: none; "title=" Mail2.png "alt=" Wkiom1c4uriainsraad3yvo3dky594.png "/>


If the host name of the current host is not www.magedu.com, change it to www.magedu.com
[' houstname '! = ' www.magedu.com '] && houstname www.magedu.com
If the host name of the current host is localhost, change it to www.magedu.com
[' houstname ' = = ' Localhoust '] && houstname www.magedu.com
If the host name of the current host is empty, or (none), or localhost, change it to www.magedu.com
[-Z ' hostname '] | | [' hostname ' = = ' n (none) '-o ' houstname ' = = ' localhoust '] && hostname www.magedu.com


Generate random numbers
RANDOM: 0-32768
Random number generator
/dev/random: The user process is blocked
/dev/urandom: Simulation generates random numbers
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/1F/wKiom1c4UtKzjYdXAADTyy6tZdo404.png "title=" Random.png "alt=" Wkiom1c4utkzjydxaadtyy6tzdo404.png "/>

Write a script that generates 10 random numbers using random and finds the maximum value.
#!/bin/bash
#
Declare-i max=0
Declare-i min=0
For I in {1..10}; Do
Myrand= $RANDOM
[$I-eq 1] && min= $MYRAND
If [$I-le 9]; Then
Echo-n "$MYRAND,"
Else
echo "$MYRAND"
Fi
[$MYRAND-gt $MAX] && max= $MYRAND
[$MYRAND-lt $MIN] && min= $MYRAND
Done
Echo $MAX, $MIN

Control structure:
Sequential structure
Select structure
If statement
Case statement
Case SWITCH in
value1)//switch value of 1
Statement1
...
;; Be sure to ";;" End
value2)//switch value of 2
Statement2
...
;;
*)//any value
Statement
...
;;
Esac
Loop structure

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/1C/wKioL1c4VC7wxTOZAABMaFQG7Z4662.png "style=" float: none; "title=" Cese1.png "alt=" Wkiol1c4vc7wxtozaabmafqg7z4662.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/1C/wKioL1c4VDHjn-HvAABho47mvpc097.png "style=" float: none; "title=" Cese2.png "alt=" Wkiol1c4vdhjn-hvaabho47mvpc097.png "/>


Write a script that accepts options and parameters, and then gets the information for each option and parameter;
And can be based on options and parameters to make a specific operation
For example: adminusers.sh--add Tom,jerry
--del Tom,blair
-v|--verbose-h|--help

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/80/1C/wKioL1c4VBTiQNEPAABIV1Qg3xo403.png "style=" float: none; "title=" Case3.1.png "alt=" Wkiol1c4vbtiqnepaabiv1qg3xo403.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/80/1C/wKioL1c4VBai_wPuAACmgN_E_o8132.png "style=" width : 650px;height:551px; "title=" Case3.png "alt=" Wkiol1c4vbai_wpuaacmgn_e_o8132.png "height=" 551 "hspace=" 0 "vspace=" 0 " Width= "650" border= "0"/>



Terminal type:
Console: Control Panel (directly connected to the display interface of the hardware device)
Pty: Physical terminal (VGA graphics)
TTY: Virtual Console (VGA)
ttys#: Serial Terminal
pts/#: Pseudo Terminal

This article is from the "11160930" blog, please be sure to keep this source http://11170930.blog.51cto.com/11160930/1773670

2016-5-15 Linux Basic Learning--case statement

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.