hi
i'm writing shell script and i'm at the point where i need getopts help
how can i use getopts and have multiple arguments (some of them is required and some of them is optional)? for instance.
i need to run shell with following arguments:
--host/ip [host/ip]
--file-list [file-list]
here i also need to run either of those, not together... but one parameter is required, and if someone just run it with --sleep that wouldn't be sufficient since --host/ip or --file-list wasn't specified..
--sleep [time]
--status [print out status]
from what I've Google'ed, all examples only shows you how to take 1 parameter and work with it, but i didn't find any where it would show you how to take more then one and in one case make something required
sounds complicated i know
Recent comments
6 hours 2 min ago
7 hours 2 min ago
10 hours 49 min ago
12 hours 3 min ago
15 hours 39 min ago
22 hours 54 min ago
1 day 7 hours ago
1 day 9 hours ago
2 days 20 min ago
2 days 2 hours ago