0

I'm writing a script that does an LDAP search and reads an LDIF file from a Sun Messaging Server style mail group and converts it to a mailman style config file. When I run my script I get the an unexpected token error. Here is my selected out put from sh -n -v myScript.sh myGroup.

...
# Disallowed Domains
#  LDAP: mgrpDisallowedDomain
#    mgrpDisallowedDomain: <domain>
#  config: reject_these_nonmembers
#    reject_these_nonmembers = ['^.@<domain1>', '^.*@<domain2>'...]
LIST_DISALLOWED_DOMAIN=$(
  grep "^mgrpDisallowedDomain: " $SOURCE_FILE | sed 's/^mgrpDisallowedDomain: //g' | while read domain
  do
    echo "'^.@$domain'"
  done
)
if [ -n "$LIST_DISALLOWED_DOMAIN" ]
then
  echo $LIST_DISALLOWED_DOMAIN | awk '
    BEGIN {
      print "reject_these_nonmembers = [";
    } {
      for(i=1;i<=NF;i++){
        printf "%s, ", $i;
      };
    } END {
      print "\b\b]\n\n";
    }'
fi

# Allowed Senders
#  LDAP: mgrpAllowedBroadcaster
#    mgrpAllowedBroadcaster: mailto:<email>
#    mgrpAllowedBroadcaster: ldap:///uid=<uid>,ou=People,o=csusb.edu,o=edu
#    mgrpAllowedBroadcaster: ldap:///cn=<cn>,ou=Groups,o=csusb.edu,o=edu
#  config: accept_these_nonmembers
#    accept_these_nonmembers = ['<email>', '@<listname>'...]
LIST_ALLOWED_BROADCASTER=$(
  grep "^mgrpAllowedBroadcaster: " $SOURCE_FILE | sed 's/^mgrpAllowedBroadcaster: //g' | while read uri
  do
    case $uri in
      mailto:*)
        mailto=`echo $uri | cut -d: -f 2`
        echo "'$mailto'"
287---->;;
      ldap:*uid=*)
        user_dn=`echo $uri | sed 's/ldap:.*uid=/uid=/g'`
        MAIL_ATTR=`ldapsearch -x -LLL -h $LDAP_HOST -D "$LDAP_BIND_DN" -w $LDAP_BIND_PW -b "$user_dn" "(objectClass=*)" mail | grep "^mail: " | sed 's/^mail: //g'`
        echo "'$MAIL_ATTR'"
        ;;
      ldap:*cn=*)
        group_dn=`echo $uri | sed s/ldap:.*cn=/cn=/g'`
        MAIL_ATTR=`ldapsearch -x -LLL -h $LDAP_HOST -D "$LDAP_BIND_DN" -w $LDAP_BIND_PW -b "$group_dn" "(objectClass=*)" mail | grep "^mail: " | sed 's/^mail: //g' | cut -d'@' -f 1`
        echo "'@$MAIL_ATTR'"
        ;;
    esac
  done
)

I get the following errors:

myScript.sh: line 287: syntax error near unexpected token `;;'

myScript.sh: line 287: `        ;;'
4

1 に答える 1