After I recently changed Ubuntu, I felt dizzy and eye bloat easily. Because I installed eye protection software on Windows, the screen lock will automatically prompt users to rest their eyes at regular intervals. Google hasn't found an
The rsh command is short for remote shell. This command starts a shell on the specified remote host and executes the command specified by the user in the rsh command line. If the user does not provide the command to be executed, RSH uses the rlogin
Simple usage
#! /Bin/sh (sleep 10; echo "username"; sleep 10; echo "password"; sleep 10; echo "PWD"; sleep 50; # echo exit) | Telnet $ IP
Connect to the remote machine and check the current directory.
Username/password is the username and
When learning Linux shell scripts, one of the most common errors is to useFor(For line in $ (cat file.txt) do ...) Read files row by row. The following example shows the result.
File file.txt content:
Cat file.txt
This is the Row No 1;
This is
$ @ Refers to all command line parameters. Each parameter is enclosed ""
$ * Indicates all command line parameters
The following procedure:
Test1.sh
-------------------
Sum = 0For VaRIn "$ @"DoLet sum = sum + $ VaRDoneEcho "sum = $
(1) substr in awkSubstr (source string, start index, length) Start index starts with 0Example:Awk '{$ A = substr ($, 2); print $ A;}' filenameAssume that only one row in the file is abcdefg, the returned result is AB.
(2) expr substrExpr substr
RMAN backup is easy to use for Oracle database backup and recovery, with low costs. For non-catalog mode, it is undoubtedly the first choice to embed the RMAN script into the shell script and then use crontab to back up small and medium databases.
#/Bin/bash
1, Wildcard
*: Match any character or string, including an empty string.
? : Match any character. For example :?ABCCan match anyABCIt is a string of four characters that can be switched to or from any character.
[…]: Match any single
Go to: http://goward.jimdo.com/2010/06/15/linux-shell%E5%90%84%E7%A7%8D%E5%BC%95%E5%8F%B7%E7%9A%84%E7%94%A8%E6%B3%95/
The difference between these characters is how they affect variables (such as $ name) and shell commands (such as date ). For any
root@bt:~/test# chgrp --helpUsage: chgrp [OPTION]... GROUP FILE... or: chgrp [OPTION]... --reference=RFILE FILE...Change the group of each FILE to GROUP.With --reference, change the group of each FILE to that of RFILE. -c, --changes like
1. Embed shell Variables
1> cdpath: this variable retains some directory information, separated by the colon.
If this variable is set, shell will first find the value saved in this variable when a directory is stored in CD;
If the CD switch
Some common shell commands in Linux
For many programmers who often program in XP, it is not a habit to suddenly switch to programming in Linux, because a lot of things that can be done with the mouse in XP before, now we use commands to complete the
If [-z "$1"]; thenEcho "You did not enter the parameters for executing the shell"Exit;Fi
If ["$1 "! = "JF"] & ["$1 "! = "Token"]; thenEcho "enter the name of the server to be uploaded: JF score, audit by region"Exit;FiCur_year = 'date + "% Y
If you need to perform operations on the base database in shell, you can first create a corresponding function, as shown in figure
Dbstr = "Tigger/pw123 @ orcl"
Exesql (){Sqlplus-S $ dbstr Set autocommit off;$1;Commit;Exit;EOF}
Phonelist = "1325
Assume that the two files file1 and file2 are represented by a and B. The content of file1 is as follows:
A B C E d
The content of file2 is as follows:
C d A C
There are basically two methods: one is the comm command and the other is the
String comparison: Result
String1 = string2 string1 equals string2: True, otherwise false
String1! = String2 string1 equals to string2: false, otherwise true
-When n string is not equal to NULL: True, otherwise false
-Z string when string is null:
#! /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. $$!
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