|
getopts bash
|
|
01-14-2010, 08:26 AM
Post: #1
|
|||
|
|||
|
getopts bash
getopts is use pretty much the same in c c++ python fpc and bash. It enables a user to deal with arguments. Here is a example script.
Code: #!/bin/bashabcn is all arguments in getopts. You can choose any characters you want. If you have a : after a letter it means that arguments must have input. Here is a example of runing the script. The script name is getoptsExamp ./getoptsExamp -abc output: alpha bravo charlie ./getoptsExamp -a -b -c output: alpha bravo charlie ./getoptsExamp -b -n codecaine output: bravo codecaine if you don't put in a argument after the -n it will display /getoptExamp: option requires an argument -- n |
|||
|
01-14-2010, 08:21 PM
Post: #2
|
|||
|
|||
|
RE: getopts bash
Very good and interesting !
"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein |
|||
|
« Next Oldest | Next Newest »
|






