(1) automatically log on to FTP
(2) Place the downloaded file to the specified local directory
(3) determine whether there are any files to be downloaded on the FTP server
#! /Bin/bash# Create a directory with the downloaded file in the format of
The test statement must have spaces before and after the equal sign, and there can be more than one space. To promote it, there must be no spaces before and after the equal sign of the value assignment statement, non-assignment statements require
I want to perform frequent operations on a file. To obtain the values of different columns in each row, I know the method isWhile read lineDoEcho $ Line | awk '{print $1}' # obtain the value of the first column in each rowEcho $ Line | awk '{print $2
#/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
root@bt:~/test# who --helpUsage: who [OPTION]... [ FILE | ARG1 ARG2 ]Print information about users who are currently logged in. -a, --all same as -b -d --login -p -r -t -T -u -b, --boot time of last system boot -d, --dead
root@bt:~/test# chown --helpUsage: chown [OPTION]... [OWNER][:[GROUP]] FILE... or: chown [OPTION]... --reference=RFILE FILE...Change the owner and/or group of each FILE to OWNER and/or GROUP.With --reference, change the owner and group of each
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
1. CTRL + W Delete the last word
2. CTRL + u delete a row
3. CD-Return to the last working directory
4. Cd ~ Return to the Home Directory
5 .! $
! $ Is a special environment variable, which represents the last string of the previous command.
Example:
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
#/Bin/sh
# Add By zhoujf. Free log file;
Dir_list = "/product1/port/bin/ocs_subscriber_import/back"
Log_list = "* 201 *. unl"
Gz_day = 3Del_day = 30Core_day = 7
Cur_time = 'date + "% Y % m % d % t "'Echo "start at [$ cur_time]"
For dir in $
This post was last edited by ps49324955Integer comparison-------------------------------------------------------------EQ equals to, for example, if ["$ A"-EQ "$ B"]-Ne is not equal to, for example, if ["$ A"-ne "$ B"]-GT is greater than, for example,
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
TR is used to delete control characters in a file or convert characters.Syntax: TR [-C/D/S/T] [set1] [set2]Set1: Character Set 1Set2: Character Set 2-C: complement. Use set2 to replace characters not included in set1.-D: delete all characters in set1
2.4 pipelines and redirection2.4.1 redirectionFile descriptor redirection description0 1> standard input2> standard error output> Append2> & 1 standard output and error output to the same fileSpecifically, you can use/dev/null to effectively discard
Compile a simple shell command parser
Environment:
RedHat 9.0 kernel 2.4.20
VI document editor 6.1.320
GCC 3.2.2-5
Steps:
Step 2: Write the simplest shell command interpreter. This program is taken from apue Example 1-5. The command cannot
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
This script is used to automatically back up version libraries under the svn directory and traverse the libraries through awk. The advantage of this is that when someone adds a new version library, there is no need to change the code, the program
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:
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.