1. Shell Script debuggingUse the SH command to check the syntax of the shell and trace the execution steps. SH [-NVX] script.sh-n: Do not execute script, only check for syntax problem-V: Print script before execution-x: Print script to use2. Check
First, Introduction[equivalent to test, which is the internal command of bash, the coreutils package for the Gnu/linux system usually takes/usr/bin/test and/usr/bin/[commands. If we don't specify the absolute path, we usually use Bash's own commands.
Meet
Meaning
&&
Command1 && command2: Command 1 returns True (Command return value $ = = 0), command 2 can be executed. Can be used for if judgment.CP 1.txt.. /&& echo "succes" #-->successCP 1.txt.. /&& rm-f. /1.txt && echo
Exit statusThe built-in command in bash does not create a new process, but it also has the exit status, usually with 0 to indicate that a success nonzero indicates a failure, although the built-in command does not create a new process, but there is
In the loop, sometimes you need to force out of the loop when the loop end condition is not reached, like most programming languages, the shell also uses break and continue to jump out of the loop.Break commandThe break command allows you to jump
The array in the shell is the same as other programming languages, considering that the shell is a weak type of scripting language that can be defined and used directly in command limeFor example:$a [1]= "Monday"$echo ${a[1]}Monday$Note that here
Parallelize)
// Load data 1 ~ 10
Val num = SC. parallelize (1 to 10)
// Multiply each data item by 2. Note that _ * 2 is recorded as a function (fun)
Val doublenum = num. Map (_ * 2)
// Memory cache data
Doublenum. cache ()
// Filter data.
I just finished my work and just analyzed a reinforced game. I remembered that the analysis process was not found in the last post, and I recorded a video. Here I will simply add it.For the new version of this shell, there are also tutorials on the
This is a simple shell script, which contains a lot of shell script writing skills, although the script is compiled from other video tutorials, however, it has paved the way for me to write shell scripts in the future.
#!/bin/bash############## main
1 shell variable BasicsShell variables are very "weak" variables. By default, a variable stores a string, and shell does not care about the meaning of the string. Therefore, to perform mathematical operations, you must use commands such as let,
In shell, the simplest debugging assistant outputs the echo statement. Many echo statements can be put into the code for debugging, but it takes enough time to locate
The information to view. You may need to output a lot to find the information you
Developed on the Linux platform, another script file is often executed on the console. The following methods are frequently used:./My. ShOrSource my. ShOr. My. Sh; What are the differences between the three methods? Let's take a look at how to call
Understanding:
By default, Linux commands obtain input from the standard input device (stdin) and output the result to the standard output device (stdout) for display. Generally, the standard input device is the keyboard, and the standard output
[Copyright statement: reprinted. Please retain the Source: blog.csdn.net/gentleliu. Mail: shallnew at 163 dot com]
The grep command is used to obtain the line information that complies with the rules. This section describes how to use awk to obtain
I 've been learning Perl, and shell has forgotten about it. Today I wrote a small script to determine the operation when the second variable of the script is not equal to a certain string.
If [$? -EQ 0] & [$2! = "WP"]
Then
: # Omitted
Fi
If the
Location parameters
Internal Parameters
Just as the LS command can accept directories and other parameters as its parameters, parameters can also be used in shell programming. Parameters in Shell programs include location parameters and internal
Don Libes, author of objective CT, made the following definition for objective CT when it was written in 1990: automated CT is a software suite for automatic interaction (Automated CT [is a] software suite for automatic interactive tools ). The
[Shell] example of if, for, while flow statement and integer string comparison
Preface:
In fact, Shell is a command interpreter that explains the commands entered by the user and sends them to the kernel. In addition, Shell has its own programming
Linux Shell script monitors the running status of WAS (WebSphere Application Server)Principle: You can call the WAS script wsadmin. sh to obtain the instance status.Operating system version:
[Root] # head-1/etc/redhat-releaseRed Hat
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