has always been in the terminal execution shell and other scripts, whether the Web interface can also do so, of course, is also possibleThis article takes CentOS 6 as an example to install the configuration
Installing spawn-fcgiwget Https://github.com/lighttpd/spawn-fcgi/archive/spawn-fcgi-1.6.4.zipUnzip Spawn-fcgi-1.6.4.zip RM spawn-fcgi-1.6.4.zipMV spawn-fcgi-spawn-fcgi-1.6.4/spawn-fcgiCD spawn-fcgi/./autogen.sh./configureMake make install
Installing FcgiwrapYum-y Install fcgi fcgi-dev
The bash script under Linux does not support line breaks \r , and if you run a file that is copied from Windows, you /bin/bash^M: 坏的解释器: 没有那个文件或目录 may want to check if the file format is incorrect.If this is a format problem, there are two ways:First, find the replacement method
First step: cat -A filename view ' \ 及 r \ 空白符, n \ 会显示为 r \ ,而 会显示为 ^m '.
S
There are many ways to read a file with a bash script. Look at the first part, I used the while loop and its subsequent pipe command (|) (Cat $FILE | while reading line; do ...) and increment the value of I in the loop, and finally, I got what I wanted. The main reason is that the pipeline command initiates a child shell to read the file, and any operation in the (Child Shell's) while loop (for example, I +
Today, I wrote a shell script and reported an error during execution. the script content is simple and only for testing: Shell Code :#! /Bin/shecho quot; testshell quot; the specific error message is as follows: Shell code: [root @ localhosttest] #. /test. sh-bash :. /test. sh:/bin/sh ^ M: bad... today, I wrote a shell scri
result of the execution state result is not 0.Single-Branch condition judgmentIf condition, then the execution status result of the condition is 0 end or if condition then the execution status result of the condition is 0 end2 Branch condition judgementIf condition, then the execution status result of the condition is 0 otherwise the execution state result of the condition is not 0 end or if condition then the execution state result of the condition is 0 otherwise the execution state result of
Up (BASH script Programming copy system library file )To re-edit grub as silent mode:1.vim/mnt/boot/grub/grub.confDefault=0Timeout=3Title Nick Linux (2.6.18)Kernel/vmlinuz ro root/dev/hda2 QuietInitrd/initrd.gzHow to implement terminal prompt information:2. Copy the host file:cp/etc/issue/mnt/sysroot/etc/3. Re-edit issue information:Vim/mnt/sysroot/etc/issueNick release 5.9 (Final)Kernel \ r on an \mHttp://
the following several casesValue 1) This is not the condition, but the value of the variable, the first value of the variableExpression...;;( None of the options can end with a double semicolon)Value 2)-the second typeExpression...;;...*)Expression...EsacValue can have more than oneExercise: Write a script that asksLet the user type the content from the keyboard and then use our
Script execution:The script starts a child shell process when it executes. Scripts that are started on the command line inherit the current shell environment variables, and the system-initiated scripts (not command-line launches) require a self-defined amount environment variable.Program Status Return code:0: Execute correctly.1-255: Error execution, 1, 2, 127 system reserved.Exit
Role
Exits
Because of the recently written node. JS program Because of some bugs, there will be some automatic exit problems, so it needs to be found in time when it exits, and restartSo looked up some information, wrote a bash program, the function is very simple, is every 3s to determine whether the node program at 6000 port is running, if not found 6000 port, then the command to execute the startup program, has been used for a period of time, feel good, simpl
.
$ {Varname % pattern}
If the pattern matches the end of the variable value, delete the shortest matching part and return the remaining part.
$ {Varname % pattern}
If the pattern matches the end of the variable value, delete the longest matching part and return the remaining part.
$ {Varname/pattern/string}
Replace the first part that matches pattern with string
$ {Varname // pattern/string}
Replace all matching parts of pattern with string
Today, there is a very strange problem, the shell script that has been running very normal failed, but yesterday added a parameter.Error message:/bin/bash^m:bad interpreter:no such file or directoryLater found that root cause, modified the file yesterday in Windows modified save, and then uploaded. The file is recognized as a DOS format.Use the following command in this command mode to view:: Set FFreturn R
DescriptionCurrently, PowerShell under Linux is approximately equal to pash. I hope you focus on mono, focus on pash.One-click installation script includes for Centos6,centos7,ubuntu 14.04 Ubuntu 14.10Installation script is installed with Yum or APT, mono official latest version, then compile and install the latest version of Pash, and finally generate two commands:Mybuild for compiling pashMypash for runni
Inspired by the oneStack script:
It turns out that the script can be executed with a certain user permission easily.
The script content is as follows:
#! /Bin/bash # filename: test. sh # email: wangxiaoyu@Live.com # date: 2013-09-02user = "root" if ['whoam '! = "$ {User}"]; then exec su-"$ {user}"-c "sh $ {PWD}/test
This is the automatic deployment of the standalone version. For manual deployment, refer to my other article:
Http://blog.csdn.net/sheismylife/article/details/6737127
First download the mongodb-linux-x86_64-2.2.0.tgz, decompress it and put it under the project directory MongoDB.
Then prepare the startup script MongoDB:
#!/bin/sh ### BEGIN INIT INFO# Provides: mongodb# Required-Start:# Required-Stop:# Default-Start: 2 3 4 5# Default-Stop:
Question: If a user is opening several bash interfaces at the same time, which Bash's history command record will be written in ~/.bash_history?A: All bash has its own histsize pen recorded in memory, because the log file will not be updated until the logoff, so the last bash will be last written, and the other bash co
#! /Bin/bash# Call this script with at least 10 parameters, for example#./Scriptname 1 2 3 4 5 6 7 8 9 10
Minparams = 10
Echo
Echo "the name of this script is \" $0 \"."Echo "the name of this script is \" 'basename $0 '\"."
Echo
If [-n "$1"]#-N test string be quoted is not null.ThenEcho "parameter #1 is $1" # Need quot
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.