Recently debugging a program based on Matlab, accidentally found a few more interesting skills, to share with you (very likely it is too rookie, not involved in this respect, generous home please do not laugh, to help you to a point of praise. )
1.
The meaning of the-Z to-D in the conditional judgment in the shell
Copyright Notice: This article original articles for bloggers, repost please indicate the source. If in doubt, please contact me. I'll be appreciated.
When defining a variable, the variable name does not have a dollar sign ($), such as:
$variableName = "Value"
As shown in figure:Note 1:
1. There can be no spaces between the variable name and the equals sign, which may be different from any
${#string}Returns the length of the $string
${string:position}In $string, start extracting substrings from the $position position
${string:position:length}In $string, the $length-length substring is extracted from the $position
When executing shell script, if judgment statement error#!/bin/bashif [0 = = $testNum]then echo "Check result:0" fi Testnum is not defined when used, no assignment is empty (originally defined, just a clerical error is similar to tsetnum), after
1. Prepare for Work 1.1 install spark and configure spark-env.shYou need to install spark before using Spark-shell, please refer to http://www.cnblogs.com/swordfall/p/7903678.htmlIf you use only one node, you can not configure the slaves file, the
Requirements: Use the free command to accurately monitor RAM utilizationKnowledge: GREP,FREE,AWK,BCThe script is as follows[[email protected] scripts]# cat mem.sh #!/bin/bash-# free-m represents output in m units, and if the memory is large enough,
Shell special Characters
* Any of the characters
? Any one character
#注释字符
\ de-Semantic characters
| pipe character
$ variable prefix,!$ combination, regular inside means end of line
Multiple commands are written to
Shell Script Introduction
Shell is a scripting language
The shell has its own syntax, and can use logical judgments, loops, and so on.
Functions can be customized to reduce duplicate code
The shell is a collection
The shell getopts and getopt usage 1.getoptsgetopts (shell built-in command) cannot directly handle long options (such as:--prefix=/home, etc.), Getopts has two parameters, the first parameter is a string, including characters and ":", each
number of logged-in users: who | Wc-l
See which users are logged on to the system : who
Create a new file /bin/ct11, enter a command in the file,chmod Set the Execute permission for the file
# cat >/bin/ct11W.H.O. | Wc-lPress Ctrl+d# Cd/
For the set in the shell and the use of eval:Set position parameters (same as command line script)The role of Eval is to describe the second time[Email protected]:/home/xpg# set--Hello Shanghai Liangge [email protected]:/home/xpg# eval echo \$$
Shell Introduction* shell是一个命令解释器,提供用户和机器之间的交互。* 支持特定语法,比如逻辑判断、循环。* 每个用户都可以有自己特定的shell。* Centos7默认shell为bash。* 还有zsh、kshCommand historyWe have the command on the terminal, all have its history, such as pressing the UP button at this point will see
Jar Package:http://www.ganymed.ethz.ch/ssh2/The advantage of this source is not dependent on a lot of other packages, copy come clean. Specific code implementation can be seen below, or refer to the official documentation, in the download of the
Windows uploads shell scripts to Linux in a format that is DOS. The DOS mode shell script will no longer run correctly under Linux, and needs to modify the file mode to UNIX. 1 view File Mode method on the Linux server, open the shell script with
Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about
Shell script instance
Note: Some variables related to parameters passed to shell:$ # Number of command line parameters$? Return Value of the Call Command$ Process ID of the current process$! Process Number of the last background command$0 the first
From: http://mindream.wang.blog.163.com/blog/static/2325122220084624318692/Fork (/directory/script. Sh)Fork is the most common. It uses/directory/script. Sh directly in the script to call the script. Sh script.Run a sub-shell script to execute the
Introduction: among the many anti-virus products, Kaspersky has a good reputation among users. Many users say that Kaspersky's Virtual Machine shelling technology is very strong. However, I only made a small adjustment to the general "Shelling" step,
The following program implements a simple mp3 playback function. You can set the path to search all mp3 files and play them in sequence.
#! /Bin/sh # very simple example shell script for mp3 player #2014-5-6 by slwang # search all mp3 files and play
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.