#! /Bin/sh
# The first line is to tell the system who will execute this dumb.
$ ## Number of parameters transferred to the script
$ # ID of the current process during script running, often used as the suffix of temporary variables, such as haison. $
$! # ID of the last process running in the background
Chmod U + x ABC. Sh # grant the user the execution permission
Chmod A + rwx ABC. Sh # grant all permissions to all users
./ABC. Sh
Who-A # Show all user information
Echo-e "\ 033 [31 m \ 033 [05 m error: No Log Type $1. \ 033 [0 m"; # Flashing in red (?)
Echo-e "\ 033 [31 m error: No Log Type $1."; # Red
Tail # only display the last 10 lines of the file
File Type:
B block C character d directory l link P pipe s socket
Permission type:
R read w write x excute
File status test:
-D directory-F Regular file-l symbol connection-s file length is greater than 0, non-empty-r readable
-W writable-x executable-u file with SUID bit settings
Example: [-r haison. C-a-W Hai. C]
String test:
= Two strings are equal! = Two strings are not equal-Z empty strings-N non-empty strings
Numerical test:
-Equal eq-ne unequal-GT greater than-lt less than-ge greater than-ge equal-Le smaller
The variable defined in the function starts with an underscore (_).
Kill process:
PS-Ef | grep XXX # pgrep xxx
Kill-S 9 PID
Or pgrep XXX | xargs kill-S 9 # note that pgrep must be accurate here, otherwise it will kill by mistake ..
Or kill-S 9 'pgrep XXX'
Or pkill-9 XXX # XXX must be accurate, otherwise it is very dangerous =
Curly braces tell shell that we want to print the num variable
Echo "this is the $ {num} Nd"
> Write the file and overwrite the old file
> Add the end Of the file
Hard drive mounting upon startup:
/Etc/fstab
/Dev/sdb/mnt ext3 defaults 0 0
Select usage
Echo "What's ur favorite OS? "
Select VaR in "Linux" "gnuhurd" "Free BSD" "other"; do
Break
Done
Echo "you have selected $ Var"