If [-N ' $]Thenecho "111"Elseecho "222"FiExit 0Execute SH my.sh par hint syntax error:unexpected end of file. Error excuse me.
Text editing is a file written by Notepad under Windows, running under the Cygwin simulation Linux software environment.
$: The script name, relative path, or absolute path depends on how the call is being invoked. If the./dollartest.sh call is in the parent directory, then $ is./dollartest.sh, if it is a full path call, such as "/root/test/dollartest.sh", then $ is "/
Test can be understood to be the same as [], [[]] in logic and logic or at times, it can be split into multiple []
[Cmd-a cmd]
#!/bin/bash
a=23;
If [$a-gt 18-a $a-lt]
then
echo ' Young && handsome '
else
echo ' Just so ... "
fi
Http://www.cnblogs.com/chengmo/archive/2010/10/23/1858879.html
In daily life, random numbers are actually often encountered, want to throw dice, lottery, and draw lots. Oh, very simple can be achieved. So in doing programming, really to design a
Let's take a look at the return value of the two functions to get the way:
#!/bin/bash
#函数返回值获取测试.
function fun_test ()
{
#在函数内部是不能有其他的任何一条打印语句.
Echo
}
val=$ (fun_test)
echo $val
Another one:
#!/bin/bash
#函数返回值获取测试.
function fun_test
Http://www.ha97.com/4021.html
1. Delete 0-byte filesFind-type f-size 0-exec rm-rf {};
2. View processArrange by memory from large to smallPS-E-O "%c:%p:%z:%a" |sort-k5-nr
3. By CPU utilization from large to small arrangementPS-E-O "%c:%p:%z:%a"
how Shell arrays operate
number of array elements ${#array [@]}
all elements of an array ${array[*]}
string length ${#str}
1, get the number of elements of the array:
array= (Bill Chen Bai Hu);
num=${#array [@]}///Get the number of array
Use in shell programming to determine parameters within the IF statement
–b returns True when file exists and is a block file
-C Returns True when file exists and is a character file
-D returns True when pathname exists and is a directory
-E Returns
In the Linux shell command expr is not very noticeable, but it works very well. So far, I personally think the biggest role is two-arithmetic and string operations.
First said arithmetic, in the shell arithmetic not simple subtraction, should write
command Substitution
In Bash, $ () and ' (inverted quotes) are used for command substitution.The command substitution is similar to the variable substitution, which is used to reorganize the command line, complete the command line in the quotation
Original:Http://blog.pureisle.net/archives/1352.html
The Shell provides a large number of basic operations that are useful in scripting. The Shell evaluates the arithmetic expression you provide, performs an operation expansion, and replaces an
-S file file is somefile 0 o'clock
[f]: Determines whether it is a file [-
X "/bin/ls"]: Determines whether/BIN/LS exists and has executable permissions
[-n "$var]": Judge $va R variable has a value
["$a" = "$b"]: To determine if $a and $b
Experimental three shell program design: Shell Foundation
Experimental purposes:Further consolidate the basic grammar of Shell programming language and deepen the understanding of the learned knowledge.
Experimental requirements1. Use of four
The difference between Su and Su-
The former only switches identities, but the shell environment is still the original user's shell, while the user and the shell environment switch to the new user. The PATH environment variable error will not
Just started contacting the mongdb shell. Here is a record of the learning process.
Open the shell in the console.
Linux Environment:/usr/local/mongo/bin/mongo
Window Environment: D:\mongodb\mongodb-win32-i386-2.0.6\bin>mongo
The basic section
Transferred from: http://www.cnblogs.com/penghong2014/p/6065838.html
1. First download historian.py script, download address: Https://github.com/google/battery-historian2. Unzip the download and go to the
Enter HBase Shell console
$HBASE _home/bin/hbase Shell
If you have Kerberos authentication, you need to use the appropriate keytab for authentication (using the Kinit command), and then use the HBase shell to enter the certificate successfully. You
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.