Linux 15th day vim and Scripting Basics
Time: 20180801
Vim Text Editing Tool
Command mode
Y copy
P Paste
G Navigate to document to first line
G navigates to the last line of the document
^ Position the front non-null character of a row
0 position the absolute beginning of a line
$ locates the end of a line
W jumps to the header of the next character
B Jump to the first character's header
e jumps to the tail of the next character
U Undo Last Action
R replaces the current character with the specified character
Ctrl+r undo the last Undo
. Perform the Last Action
V Visualization mode
Enter edit mode
I insert mode
A enters edit mode behind the current character
c Change, change the character
Last-line mode
W Save
Q exit
! Force or command in the back to temporarily execute the command
X Save exit
R read into a document content
Adjust VIM working characteristics
Last-line mode
: Set Num|nonu Display line number
: Set Ic|noic ignoring character case
: Set Ai|noai Auto Indent
: Set Si|nosi Smart Indent
: Set Hl|nohl Search highlighting
: Syntax On|off syntax highlighting
: Set List|nolist Displays special characters
: Set Fileformat=dos:unix | Set ff= (Dos|unix) settings File Save format
: Set Coursorline cul nocul positioning cursor in the row
: Set paste|nopaste copy reserved format
: Set Tabstop|ts=num sets the TAB key to how many characters can be skipped at a time
xDD making a 16 binary file or converting the file
Script
Scripting specifications
The language used by the first behavior call
FileName:
Version:
Change Date:
Author:
Description:
Variable effective Range
Local variables
The effective scope is the current shell process, and other shell processes other than the current shell, including the current Shell's
Child processes are not valid
Environment variables (global)
The effective scope is the current shell process and its child processes
Local variables
The production range is a piece of code in the current shell process, usually referred to as a function
Positional variables
The script itself is the name
$1,$2 ... Refers to the arguments that are followed when the script is called
Special variables
$* all arguments after the script is referenced, but turns it into a string
$# number of parameters after output script
[email protected] references all parameters after the script, but one reference
$? Output previous command execution status return code
Numeric operations
Let VAR=ARG1+-*/%ARG2
var=[$a + $b]
var=$ (($a + $b))
var=$ (expr ar1 ar2 ...)
Logical operations
&& | | Or! Non -
Pstree Show Process Tree
Export displays all of the current environment variables
Unset the variables that were set before the undo
ReadOnly setting read-only variables
Declare
-R Set read-only variable
-X Sets the following variable to the environment variable
-I sets the following variable to a numeric variable
Printenv Show all current environment variables
ENV outputs all environment variables for the current user
Shift move position variable, replace the original $ $ with $ $
SCP to copy files to remote, or remotely copy files to local
Linux 15th day vim and Scripting basics