Positional parameters can be moved left with the shift command. For example, shift 3 means that the original $ $ is now $, the original $ $, and so on, the original $ $, $ $, $ $ no move. The shift command with no parameters is equal to shift
If statementSyntax 1
If condition
then command (set)
fi
The condition here is to use the test statement or the bracketed statement (the previous article has been summed up)Note If statement must terminate with FI
Practice:
#if test
if ["-lt"] # "13
Linux for loops can use break and continue keywords to jump out of loops, consistent with Java usage
a common for loop structure
#语法一 for
variable in value 1 value 2 value 3.
Do
program block done
# #语法二 The for
variable ' command '
do
* Inverted quotes ' and $ () * Let's demonstrate a comparison of the output results using the inverted quotes and $ () For this result, is because the $ () in $ () has escaped to get this result because of the two \=\ in the inverted
The Find command tool is used to locate files in the directory (or even the entire file system), search Path_name-option [-print-exec-ok] #find的一般格式;
1, Find command Options (-option)
1.1. Find files and directories by name (-name):cb@standalone14:~
The writing of Linux shell scripts
VI test.sh
#!/bin/bash
###################
. /etc/profile
. ~/.bash_profile
##################
Path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Cd/home/huaxia/syslog2db&&ruby app.rb
Original address: http://www.cnblogs.com/Gukw/archive/2012/01/16/2323417.html
1,/etc/gitconfig:[GUI] encoding = Utf-8 #代码库统一用urf-8 to display Chinese in the Git GUI[i18n] commitencoding = GB2312 #log编码, window under the default gb2312,
We renamed yesterday's log 00:00:01 every day, placed it in a specific directory, and then USR1 the information number control Nginx to regenerate a new log file
Create a new shell script under directory/usr/local/nginx/logs/runlog.shNote: The file
#!/bin/bash function ergodic () {for file in ' ls ' if [D-$ '/' $file] then ergodic '/' $file else echo '/' $file >> b fi Done} init_path= "/etc/httpd" ergodic $INIT _path
Some netizens replied: "If you only traverse the directory and create an
-CP and-classpath Specify the paths of other classes that the class runs on, usually the class library, the jar pack, and so on
Windows semicolon ";" separated by semicolons on Linux: "Delimited." Use a little "." Represents the current path
Everyone must know how to get the sed into the shell variable
However, there is a problem with passing in the path variable.
#!/bin/bash
export vob=/home/fesu/server
sed-n '/^vob/{s/\ (vob=\). */\1 ' "$VOB" '/P} ' $VOB/scripts/build/ Makefile
First Master:
Parameters:
Run the HBase shell
hbase Shell Parameters
the shell that runs up after HBase
Try to run a few orders to find out:
Create ' T_person ', ' no ', ' name '
create ' t_person ', ' no ', ' name '
0 row (s) in 2.
-B file if it exists and is a block special file, True-C file If it exists and is a character special file, True-D file if it exists and is a directory, true-e File is true if it exists-F file is true if it exists and is a rule file-G file is true
First, position variables:
$ $ Gets the file name of the current execution script, including the script path.$n gets the nth parameter of the current execution script, 1~9, greater than 9, enclosed in {}, for example: ${10}.$# indicates the number
1. Command-line parameters------similar to javac parameter 1 parameter 2Java-like compiled Javac parm1 ..... In the shell, the arguments are separated from the arguments by a space. Use positional parameters to identify corresponding parameter
In the Linux shell, often input commands have a lot of similarities, even the same, if the long command, the efficiency is really very low, but can be through ctl+r, find the history of the previous input commands, it is very useful.After pressing
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