user1597811
user1597811

Reputation: 1073

shell script error [: 12: unexpected operator?

#!/bin/bash
value=$(</var/www/sym_monitor/manthan.txt)


if [ "$value" == "true" ]; then

     ps -ef|grep sym |grep -v grep |awk '{ print $2 }'|sudo  xargs kill -9;


(cd /var/www/symmetric-ds-3.1.6/bin;sudo ./sym --port 8082 --server);

fi

When I run this script manually it is running fine but when I run this script inside cron it is giving the following error.

[: 12: unexpected operator

Any Idea why? Any suggestions?

Upvotes: 0

Views: 4555

Answers (1)

choroba
choroba

Reputation: 242113

You are not running the script in bash, but in a different shell. Use single = instead of == for POSIX compliant shells.

Upvotes: 3

Related Questions