1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

tighten crontab and crontab-u parser variable detection

This commit is contained in:
Kelly Brazil
2020-08-05 11:28:37 -07:00
parent 549780c232
commit f3d84bd5bf
6 changed files with 21 additions and 3 deletions

View File

@ -235,7 +235,7 @@ def parse(data, raw=False, quiet=False):
# Pop any variable assignment lines
cron_var = []
for i, line in reversed(list(enumerate(cleandata))):
if '=' in line:
if '=' in line and not line.strip()[0].isdigit() and not line.strip()[0] == '@':
var_line = cleandata.pop(i)
var_name = var_line.split('=', maxsplit=1)[0].strip()
var_value = var_line.split('=', maxsplit=1)[1].strip()