3 ms·
Command line args would have been the simplest solution imho. Works simple for simple cases and power users will create a bash wrapper anyway. Hard to be wise
by sly010 9y ago
Command line args would have been the simplest solution imho.
Works simple for simple cases and power users will create a bash wrapper anyway.
Hard to be wise without knowing the context, but I avoid config files as much as possible, because:
- Where does the config file live on different machines?
- What if I want to have 2 configurations on one machine?
- What if I need to change the list dynamically?
`for ip in sys.args` would give you most flexibility.
- sasa_buklijas 9y agoI agree but I wanted to avoid this: ... writing 34 IP addresses as CLI parameter, that is around 373 letters, is not a nice solution.
- jcoffland 9y agoA bash script where you call the CLI program once for each IP would be a very simple solution. ./script 127.0.0.1 5 ./script 127.0.0.2 5 . . . ./script 127.0.1.254 10
- sasa_buklijas 9y agoI was on windows. But OK, there is batch script also. I had to call program will all IP addresses, one by one would just not work. Your idea is fine, but it was just acceptable in my use case.
- electrum 9y agoYou can write multiple arguments in a nice way: ./script \ 192.168.1.1 \ 192.168.1.2 \ 192.168.1.3 \ ...
- sasa_buklijas 9y agovalid argument :-), accepted