Lets say I want to give this command
./maryam -e crawl_pages -d domain.tld -r "a href=\".*"
and split it.
When I run
>>>line = './maryam -e crawl_pages -d domain.tld -r "a href=\".*"'
>>>shlex.split(line)
I get the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/shlex.py", line 311, in split
return list(lex)
File "/usr/lib/python3.8/shlex.py", line 300, in __next__
token = self.get_token()
File "/usr/lib/python3.8/shlex.py", line 109, in get_token
raw = self.read_token()
File "/usr/lib/python3.8/shlex.py", line 191, in read_token
raise ValueError("No closing quotation")
ValueError: No closing quotation
What I basically want is to have the -r option for the user to input a regular expression.
The result should look like this
['./maryam', '-e', 'crawl_pages', '-d', 'domain.tld', '-r', 'a href=\".*']