man顯示命令幫助時,裏面的SYNOPSIS部分釋意

 Regarding the route command, it is a little intimidating, but take it apart and analyze it. First, realize that text not in any sort of special punctuation isrequired.Anything in square brackets ( [ ] ) isoptional.Any text in bold is literal (must be typed in exactly that way- sort of - it'll make sense in a second). So let me copy from the man page on my FC4 system:

黑體部分是一定要按原樣填上去的,非黑體部分,如familiy,target等要用適當參數去代替的

Code:
route [-CFvnee]
route [-v] [-A family]add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If]
route [-V] [--version] [-h] [--help
Ok, the first line:
Code:
route [-CFvnee]
That says you run can invoke route with zero or more options. The stuff inside the square brackets is optional; you don't have to type them on the command line. If you do, it will alter the way the program runs. There will be a description further down in the man page that describes what each option does. The leading '-' in the set of options is an indicator that these are command line options. In this case, the command allows you to combine multiple, single letter options into one dashed option. In other words "route -n -F -C" is equivalent to "route -nFC". That is just an example. You'll need to read the descriptions of the options to know if it makes any sense to combine them in that manner.

Second line:
Code:
route [-v] [-A family]add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I] [reject] [mod] [dyn] [reinstate] [[dev] If]
 
Looks really complicated, right? It's actually not too bad. The thing to notice is the "add" toward the beginning. It's not in brackets, which means it'srequired on the command line. So why didn't the previous linehave the "add"? Think of it as a mode of operation. The first version of the command is likely a query. As the administrator, you just want to know what routes are available. However, there are times when you want to add a route to the table. This form of the command is saying you use the "add" word to tell the route command that's what you intend. When the add command is present, there are other options the program will recognize and act on (as opposed to a simple status query). Again, just to reiterate the point, anything in brackets is optional. You can put it on the command line or omit it. One thing to note though, the "-v" and "-A family" options comebefore the add command. Route will complain if you try to put them afterward. Similarly, any of the stuff listed after "add" cannot be used before "add".(命令選項及參數的順序要遵循上面顯示的順序)

So what's this: [-net|-host](只能選一個,或者都不選)
That says you can have either "-net" on the command line or "-host" but you cannot have both. You can omit them both entirely, but both cannot be present on the command line at the same time.

Now, you'll also notice "target" is not in bold. That's because you have toreplace it with the appropriate value to achieve whatever task you're trying to accomplish. Again, if it's in bold, it's usually literal text. If not, thenit means it's a user-supplied data/parameter/argument.

All the other stuff is pretty similar. Take this guy: [netmask Nm]//如果在命令行中加了netmask,則其後面一定要接一個具體的掩碼值(NM)
That says if you supply the netmask keyword on the command line, you are obligated to include Nm, which would be the user-supplied value for the netmask.Both pieces are enclosed by the square brackets, meaning they are optional. If you include it though, you need to provide both the keyword and the associated value; youcannot give one and not the other.

There is one last awkward looking one: [[dev] If](兩個層次的可選項
What's with the nested brackets? That's just saying there are actually two layers of optional text. The command does not need to specify either of these options. If it does, the command can specify just the If part (omittingdev because it's inside nested square brackets). Or the command can specify both pieces.


Third line:
Code:
route [-v] [-A family]del [-net|-host] target [gw Gw] [netmask Nm] [metric N] [[dev] If]
I won't go over this in much detail because it's very similar to the previous line. The difference to notice is that "add" has been replaced with "del". This form of the command would delete a route from the table. Just as with the add form of the command before, there are special option that the command will recognize when deleting a route. You should notice that delete doesn't accept the same set of options that add does. They both share options, but the del version of the command does not support all of the options add does.


Fourth line:
Code:
route [-V] [--version] [-h] [--help]
This is sort of fluff really. It's that the man page authors took the time to explicitly list the run-time help options the command supports. You will see some man pages collapse this into the first line's version of the command.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章