I have a couple of arguments inside a list (array, e.g.
$@) and I'd like to know if the option
-v is in the list.
In Python I would simply do:
verbose = "-v" in sys.argv
How do I achieve that in shell without much code?
Note that your Python code is not correct except in extremely simple cases. It detects an argument
-v anywhere on the line, even if it's the argument of another option or after non-option arguments. The correct way to parse options in Python is with