bash script: making options?
Hi, I'm not sure whether this is the correct place to post this, but here goes. I'm learning how to write bash scripts and I was wondering how to make a script so it could have different options, you know, like rm -rv or cp -v. I have written a simple script and want to make it so I can pass these options to it when run. So far I have it so it checks if there is an argument, and if there is it prints the help screen and exits, I could type: command -I -like -tabasco -sauce, and I get the help screen. But I would like to be able to add more options to it. So could someone kindly explain to me how this is done, or point me in the right direction, any help at all would be excellent.
Thanks John |
|
I spent about two hours looking on there today, could you please tell me which part I should be looking at. After the two hours I got bored and did stupid stuff, like have a script ask me if I wanted to be root, and say something stupid to me after I say yes.
Thanks edit - damn, never mind, after clicking the link I saw it in two seconds. I can't believe I missed it. Thanks very much MicahCarrick John |
Sure. And for other people reading this post, Using getopts to read the options/arguments passed to a script.
|
hehe, once again, thanks, I love this place.
|
All times are GMT -5. The time now is 08:42 AM. |