I am trying to check if command execution is successful and accordingly we need to perform some activity.
nexec -i -e service rsyslog restart
if $? -ne 0
echo "failed to restart the service"
echo "service restarted successfully"
I am getting below error nsh:line_no command not found:1
Any suggestion where I am getting wrong here.