One, the source commandFunction: Read and execute commands in the configuration file in the current bash environment1. Command formatSource configuration file or. Configuration file2. Command examples[Email protected] ~]#
The replacement function of SED is quite similar to the VIM syntax.Replace 1 to 10 rows of Nologin with login[[Email protected] ~]# sed ' 1,10s/nologin/login/g '
In shell programming, "EOF" is usually used in conjunction with "
Interactive Program (command)
The content in the middle of "EOF" will be entered as a standard input to the "interactive program", when the shell sees
Although the application of automation such as puppet saltstack in the environment is now realized, it is unavoidable to write some simple scripts to execute shell commands in batch.Python Paramiko module is currently used more comfortable module,
Shell's advantage: You can call Linux system commands directlyBasic syntax for shell scripts:Script name ends with. shThe first action of the program #!/bin/bash, tell the system this is a shell scriptWith # as a commentHow shell scripts are
Echo-E: Enable conversion of backslash control characters-E: Turn off the conversion of the backslash control character (this is the default)-N: Cancel line break symbol (with the \c character under the-e option agreeControl parameters Under-e
Use of arrays$array _var= (1 2 3)--use parentheses to define an array with a column value$echo ${array_var[0]}--The first element of an array$array _var[0]= "Zero"--defines an array using the form of an index and a value$echo ${array_var[@]}--Print
Condition test Type in Bash script: integer testString testFile testExpressions for conditional tests: [Expression][[expression]] expression must have a space before and after itinteger test :-eq: Tests whether two integers are equal and equal to
Shell scripts can also receive script parameters, like commands and applications, as they are executed .An application example:VI addhead.sh:Suaddhead ns=591 $Perform:./addhead.sh Rtm_step10_lap.dat rtm_step10_lap.su (where rtm_step10_lap.dat is
This morning a friend suddenly QQ asked, shell programming function why return can only be an integer, how to return the execution of the function and save to a variable. In fact, this problem is very good to solve---only need to seriously
Prompt effect: Code: # sexy solarized bash prompt, inspired by "Extravagant Zsh Prompt "# customized for the solarized color scheme by sean o ' Neilif tput setaf 1 &> /dev/null; then if [[ $ (tput colors) -ge 256 ]] 2>/dev/null; then
The interactive mode is where the shell waits for your input and executes the commands you submit. This pattern is called interactive because the shell interacts with the user. This mode is also familiar to most users: Log in, execute some commands,
"Bash shell built-in Commands"Type-a:File: Represents an external commandAlias: The name set by the command aliasBuildin: Internal commandNote: The execution of a command can be performed using both absolute and relative paths (./)."Directories and
1. Two modes of this article command:Interactive mode, the shell environment for hive:hive > ....Non-interactive mode: normal Linux command mode :% ... ..2.Hive Shell Common operations1) Hive-e: Executes the specified HQL from the command line and
Today's operation encountered a problem, need to redirect the content to the file, and then rename the use of the file, the result of the redirection has been thrown out of the exception, the following nature will be followed by a variety of
Tenth line:https://leetcode.com/problems/tenth-line/Test Instructions: prints the 10th line of a file.The problem involves several points:1. How do I read a file?2. How do I find line 10th?3. What if the file is empty or less than 10 lines?Solution:1
Linux bash Shell's declare declare or typeset built-in commands (which are exactly the same) can be used to constrain the properties of a variable. This is a way to use a less restrictive definition type in some programming languages. Command
When you write a shell script that starts with the Crontab timer task, if the shell script execution time exceeds, Crontab pulls the script time interval, this time may appear the same script simultaneously initiates several times the phenomenon.
In the shell, arguments can be passed to a function when it is called. Inside the function body, the value of the parameter is obtained in the form of a $n, for example, $ $ for the first argument, and $ = for the second argument ...Examples of
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