Global Growth Business Network experts and wireless network pioneer American Network (NETGEAR) company announced, will add 4 slots Desktop storage devices ReadyNAS NVX for business users to provide more comprehensive services. ReadyNAS NVX has further expanded its award-winning lineup of
Content Summary: ReadyNAS family members include for individual consumers, the ReadyNAS duo series for Soho Network, as well as the ReadyNAS nv+, ReadyNAS 1100 and ReadyNAS Pro Three Enterprise series for medium and Small business network.
The emergence of audio and video i
Http://readynas.netgear.cn/download/intelligent_management.aspNETGEAR RND2000 Short Reset.Close the ReadyNAS.Find the small hole where the reset key is located, ReadyNAS Duo is on the back of the device and has a "reset" callout.After turning off the device, use an object such as a PIN to hold the reset key in the hole and then turn on the ReadyNAS to ensure that the reset key is continuously pressed for ab
... do program segment done
#!/bin/bash#program:# This program shows "Hello World!" in your screen#History:#205/08/3 rhx First ReleasePATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHs=0i=0for i in $(seq 1 100)do i=$(($i+1))s=$(($s+$i))doneecho "The result of '1+2+3+...+100' is --> $s"
Note: (seq 1 100) indicates the sequence.
For Loop processing of numerical values
The left and right sides of the inner brackets do not require spaces, but try to add sp
corresponding jpge file for each GIF file in the current directory#! /Bin/bash# Program:# Parameter Extension# History:#2011/04/23 wcdj first releaseFor Image in *. gifDoCjpeg $ image >$ (image % GIF) JPGDone
Note::There are many ways to use parameter extension. For more information, see p.60 in [2.
(9) script tracking and debuggingSh-[nvx] scripts. ShParameter meaning:-N: do not execute the script. Only query syntax problems. If there is no syntax p
variable namesTotal number of fields owned by each line of NF ($0)Nr is currently processing the "row number" DataFS separator. The default value is Space key.You can use the begin keyword to preset awk variables, such:CAT/etc/passwd | awk 'in in {FS = ":" }3 3 Note: All operations on {} can be separated by semicolons (;) if multiple commands are required, or each command can be separated by pressing [enter.5. Trace and debug shell scriptsSh [-nvx] s
the parameter only.
View results:
Case judgment
We have used switch case statements in programming languages, which are much more convenient than if else in some cases. in shell scripts, there are similar statement blocks called case in esac, in the above example, we use another method:
See the results:
Loop
1. while do... done
This is our common while loop. When the condition is met, the statements in the loop body are known to be executed until the condition is not met and the cycle is
Shellscript tracking and debugging1. shell script debuggingRun the sh command to check the shell syntax and follow up the execution steps. Sh [-nvx] script. sh-n: do not execute the script. Only check for Syntax problems.-v: print the script out before execution.-x: print the used script out.2. Check for syntax errorsUse sh-n. If a syntax error occurs, a prompt is displayed.
[Work @ www sh] $ sh-n. sh. sh: line 7: syntax error near unexpected token '
-N: Display host address and service in numeric format, IP and port not reversed -V: Verbose format-VV,-VVV --line-number: Show rule number -x:exactly, do not make unit conversions for counter count results, and display their exact values # iptables-l-NVX==> rules for querying the filter tableMatch condition: Generic match-S address: Specifies the range of packet source IP address matching; either IP or network segment(in the format 172.16.
. execute commands as mentioned in chapter 5. multiple blank spaces between commands and parameters will be ignored.
3 blank lines are also ignored, and the resulting keys are also considered as space keys.
4. if a row contains too many contents, you can use \ [Enter] to expand to the next row.
5 # annotations
5. we can use source xx. sh to execute the script, but this script is executed in the parent process, so the variable degree in the script can take effect.
6. use the judgment symbol []
1.
Con1, the second is Con2, the third layer is Con3For example, all files under the display directoryfilelist= ' ls $dir 'for filename in $filelistDo#echoDone————————————Debugging of shell scriptsSH-NVX script.sh-N Do not execute script, check syntax error no problem, no display-V Print script to screen before execution-X Displays the contents of the script used to the screen = = Print execution track————————————————#用mv取代rmVI. BASHRCMkdir-p ~/.trash #
not established.oruntil [condition]DoProgram SegmentDoneWhen the condition is established, it terminates the cycle, otherwise it continues to cycleorFor Var in con1 con2 Con3 ...DoProgram SegmentDoneSuch as:network= "192.168.1"For Sitenu in $ (seq 1) #seq为sequence连续的缩写DoPing-c 1-w 1 ${network}.${sitenu} >/dev/null result=0|result=1if ["result" = = 0];thenecho "Server ${network}.${sitenu} is up"Elseecho "Server ${network}.${sitenu} is down"FiDoneorNumerical processing of For...do...donefor (ini
with TCP protocol and source address 10.5.2.3 and target port 3389# Tcpdump-nnvvS tcp and src 10.5.2.3 and dst port 3389
Capture packets whose source CIDR block is 192.168.0.0/16 and whose destination CIDR block is 10.0.0.0 or 172.16.0.0# Tcpdump-nvX src net 192.168.0.0/16 and dst net 10.0.0.0/8 or172.16.0.0/16
The size of the captured packet is 1514 bytes, the destination address is 192.168.0.2, the source network segment is 172.16.0.0, and the pack
of the second variable exit 1 ;; the function of esac in shell script must represent $0 by the function name at the beginning of the program, and the subsequent parameter is also $1, $2... in the Loop while [condition] nvx] scripts. sh option parameter:-n: do not execute the script, only query syntax problems;-v: before executing scloud, output the content of scripts to the screen;-x: displays the script content on the screen. this is a useful parameter! You can use sh-x script. sh to de
Before scripts runs, the most feared problem is the syntax error! So how can we debug it? Is there a way to determine whether there is a problem without directly running the scripts? Haha! Of course! Let's take the bash-related parameters for determination!
[Root @ WWW ~] # Sh [-Nvx] scripts. Sh Options and parameters: - N: Do not run scripts. Only query syntax issues; - V: before running scammers, output the scripts content to the screen; - X: disp
Shell programming: before running shell script tracing and debug scripts, the most feared problem is the syntax error! So how can we debug it? Is there a way to determine whether there is a problem without directly running the scripts? Haha! Of course! Let's take the bash-related parameters for determination! C code [root @ www ~] # Sh [-nvx] scripts. sh option and parameter:-n: Do not run the script, only query syntax issues;-v: before running scloud
$ filelistDoPerm = ""Test-R "$ DIR/$ FILENAME" perm = "$ perm readable"Test-W "$ DIR/$ FILENAME" perm = "$ perm writable"Test-X "$ DIR/$ FILENAME" perm = "$ perm executable"Echo "the file $ DIR/$ filename's permission is $ perm"Done
5. shell script tracing and debugging
[Root @ Linux ~] # Sh [-nvx] scripts. ShParameters:-N: do not execute the script. Only query the syntax;-V: Before executing scloud, output the content of scripts to the screen;-X:
to bash.
?SH [-NVX] scripts.sh???? Parameters - n???????? do not perform Script , only query syntax issues???? Parameters - v???????? in the execution Script before you start, Script content output to the screen???? Parameters - x???????? will be used to the Script content is displayed on the screen?Code to be added when scripting:???? function, version information, author and contact method, copyright notice method, history, more special comma
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.