My python code is as follows:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--cmd_list", nargs="+")
args = parser.parse_args()
cmd_list = args.cmd_list
print(cmd_list)
I am aware of the fact that if I need to pass special characters as part of command line arguments, I need to enclose them within "" or ''.
As an example the following works [passing $ as an argument]:
python3 myfile.py --cmd_list 'sh' '$L'
But, encoding '-' within braces does not help.
As an example if I trigger the following:
python3 myfile.py --cmd_list 'sh' '-L'
I get the following error:
error: unrecognised arguments: -L
Is there a way to incorporate '-' as a program argument?