I'm trying to group these conditions but it's returning:
awaited conditional binary operator
waiting for `)'
syntax error next to `$thetime'
` ( dateutils.dtest $thetime --gt '09:30:00' && dateutils.dtest $thetime --lt '11:00:00' ) ||'
I already try like:
Groups of compound conditions in Bash test
#!/bin/bash
thetime=$(date +%H:%M:%S)
if [[
( dateutils.dtest $thetime --gt '09:30:00' && dateutils.dtest $thetime --lt '11:00:00' ) ||
( dateutils.dtest $thetime --gt '13:00:00' && dateutils.dtest $thetime --lt '17:00:00' )
]]; then
iptables -A OUTPUT -d 31.13.85.36 -j REJECT
else
iptables -A OUTPUT -d 31.13.85.36 -j ACCEPT
fi
You can to the following:
#!/bin/bash
thetime=$(date +%H:%M:%S)
if ( $(dateutils.dtest $thetime --gt '09:30:00') && $(dateutils.dtest $thetime --lt '11:00:00') ) || ( $( dateutils.dtest $thetime --gt '13:00:00' ) && $( dateutils.dtest $thetime --lt '17:00:00' ) ); then
iptables -A OUTPUT -d 31.13.85.36 -j REJECT
else
iptables -A OUTPUT -d 31.13.85.36 -j ACCEPT
fi