The ubuntu10.04 system's default sh (script parser) is dash and can be viewed using the ls-l/bin/sh command. The dash parser is highly efficient, but not as powerful as bash, so there are errors that cannot be found when parsing some commands. To modify the default script parser for bash, the method is as follows: 1, command line input: sudo dpkg-reconfigure dash 2
2.1 splice with cat
1 cat command is a simple command that is commonly used. cat itself indicates concatenate (splicing)
2. The general format for reading files with cat is
Cat file1 file2 file3. .. // This command Concatenates the file content of the command line parameters and outputs them together.
3 The cat command not only reads files and concatenates data, but also reads data from standard input. To read data from the standard input, use the MPs
Tags: system time style task set str post/tmp current timeRequirements Description:Today, colleagues asked a question on Linux crontab timed tasks, saying, how to adjust a scheduled task every 2 hoursExecuted once, under this record.Operation Process :1. Execute the script every 2 hours by setting it up in the following way0 */2date >>/tmp/time. LogNote: The star
Shell script article 2 (find) 001 # cat command 002cat-n/usr/local/php/lib/php. ini # Add the row number 003cat-s cat.txt # compress multiple empty rows. One empty row 004 005 # find command 006 007 find/home/wangdk-iname "*. txt "-print #-print indicates the name of the matched file. The line break \ n-I ignores the case of 008 009 find. \ (-name "*. txt "-o-name "*. pdf "\) -print #-o: logic or 010 011 #-
Script Programming 2
Let's take a look at how to use fso for file operations. Fso is the core of file operations in vbs. As a hacker, No matter what language you are learning, you should be familiar with file operations, so please study carefully.
Let's not talk nonsense. Let's first look at the objects fso consists:
Drive object: contains information about storage devices, including hard drives, optical d
" in file.txt and calculate the number of rows.
Here, the grep command output serves as the WC command input. Of course, you can use multiple commands.
Redirection: output the command result to a file instead of a standard output (screen ).
> Write the file and overwrite the old file
> Add it to the end of the file to retain the content of the old file.
Backlash
You can use a backslash to output a command as a command line parameter of another command.
Command:
Find.-mtime-1-type
0--stdin Standard input1--stdout Standard Output2--stderr standard Errorredirectecho "This was a good idea" > Temp.txtTemp.txt content will be emptied first before entering "this is a good idea"Additionalecho "This was a bad idea" >> temp.txtCat Temp.txtPrint exit Status: Echo $?LS + 2>out.txt2 input error, output to OUT.txtCMD 2>stderr.txt 1>stdout.txtCorrect output to Stdout.txt, error output to stderr.tx
Lua learning notes: 2 Android calls Lua. Add a button in the Lua script and add a listener to the button.
Calls in Android
Try {mluastate. ldostring (readstream (getresources (). openrawresource (R. raw. test); // find the functioninluafile function mluastate. getfield (luastate. lua_globalsindex, "addbutton"); mluastate. pushjavaobject (getapplicationcontext (); // The first parameter contextmluastate. p
meet the requirements.(4) Logic test for multiple conditions: logical testing refers to the determination of dependencies between two or more conditionsIi. using the IF statement: in a shell script application, the If statement is the most commonly used process control method, which is used to perform different operations with the specific condition test results.(1) Single Branch if statement: For a light-pink-live selection structure, the correspond
There are three standard input and output in Linux, namely Stdin,stdout,stderr, the corresponding number is 0,1,2.STDIN is the standard input, read the information by default from the keyboard, stdout is the standard output, by default output output to the terminal, that is, the display and so on, stderr is a standard error message, the default will be displayed on the terminal. Since stdout and stderr are displayed by default on the terminal, in order to distinguish between the information, the
Affected Versions:2 Bgal 3.1.2Program introduction:
2BGal is a PHP/MySQL script used to publish photos and albums.Vulnerability Analysis:
The admin/phpinfo. php script of 2BGal publicly accesses the call to the phpinfo () function. Remote attackers can directly request the file to leak PHP configuration information.Solution:Vendor patch:Ben3w-----The vendor h
Summary of Linux Shell script Introduction: 2. Comparison and test procedures process control are handled by comparison and test statements. We can use if, if else and logical operators to perform the test, and some comparison operators to compare data items. In addition, there is a test command that can be used for testing. Let's take a look at how to use these commands. Practice: [python] if condition: if
In configure, the first section is: If test-n "$ {zsh_version + set}" (emulate SH)>/dev/null 2> 1; then emulate sh nullcmd =: # zsh 3.x and 4.x performs word splitting on ${1 + "$ @"}, which # is contrary to our usage. disable this feature. alias-G' ${1 + "$ @"} '=' "$ @" 'elif test-n "$ {bash_version + set}" (set-O POSIX )> /dev/null 2> 1; then set-O posixfidualcase = 1; export dualcase # For mks sh le
Android OTA update package creation script (2. Decompress), androidota
Step 1: extract (ota_from_target_files)
print "unzipping target target-files..." OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])The above code is the portal to start decompression.
Def UnzipTemp (filename, pattern = None): "Unzip the given archive into a temporary directory and return the name. if filename is of the form "f
redirect$echo "Test Redirect" > Temp.txt--Writes the output to the Temp.txt,temp.txt file is first emptied.$echo "Test redirect Second" > Temp.txt-Append the output to the temp.txt.File descriptor0--stdin Standard Input1--stdout Standard output2--stderr standard ErrorFile descriptors and redirects$xx 2>err.txt--Output the error message to the Err.txt file.$ls 1>out.txt--the console information output to out.txt,1 and
FolderExists
Getabsolutepathname: Returns the absolute path of a folder or file
Getbasename: Returns the basic path to a file or folder
Getdrive: Returns a Dreve object
GetDriveName: Returns the name of a drive
Getextensionname: Return extension
GetFile: Returns a File object
GetFileName: Returns the file name in the folder
GetFolder
Getparentfoldername: Returns the parent folder of a folder
GetSpecialFolder: Returns an object pointer to a special folder
GetTempName: Returns the nam
Now let's take a look at another method to test the script running time-use the benchmark_timer class to test the time consumed by code execution and the time between each call and the next call in the code.
Benchmark2.php
require_once 'Benchmark/Timer.php'; $timer = new Benchmark_Timer();
$timer->start(); $timer->setMarker('start_myFunction');
for($i=0; $i10; $i++){ myFunction($argument); } $timer->setMarker('end_myFunction'); $timer->stop(); $p
JSP scriptJSP scripts contain JSP expressions, declarative identities, and scripting programs. With these identities, you can declare variables, define methods, and perform operations on various expressions in a JSP page as if you were writing a Java program1. Application of code snippets in JSP Syntax format: Code snippets are more flexible to use, either as Java code or as built-in objects provided by JSPsFor example: int num=1; for (int i=1;i) { num*=i; }
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.