Hello grolschie,

i now have tested the script in a working environment.
At my site the script didn't work also.
The first problem was the string compare.
I only glanced at the script, so I didn't see the mistake.
In the future you should do string compares always in this way:

if [ "$DOMAIN1" == "OK" ]; then
...

Note on the spaces and the quotation marks.

The second problem was the way of reading the input from stdin.
I have here a complete script which should also work at your site.

-------------------------------------------------------
#!/bin/sh

# read from stdin until EOF is received
while read INP; do
  DOMAIN1=`echo $INP | /usr/lib/squid/ldap_auth ...`
  DOMAIN2=`echo $INP | /usr/lib/squid/ldap_auth ...`

  if [ "$DOMAIN1" == "OK" ]; then
    echo "OK"
  elif [ "$DOMAIN2" == "OK" ]; then
    echo "OK"
  else
    echo "ERR"
  fi
done
-------------------------------------------------------

I hope this helps.
Please let me know your results.

Regards
Matthias

Hi Matthias.

Thank you very much for going out of your way to help me. I really do appreciate it. :-)

Ah yes, "==". Otherwise, a "=" simply assigns a value to a variable, right?

Thanks for the revised script. I will give it a test asap! :-)

Regards,
grolschie




Reply via email to