HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] AW: FaxDispatch: Print some faxes on a network printer



> From: Sebastian Mayer
> Sent: Friday, July 02, 2010 9:18 AM

> By the way, the case-statement works fine, that's important for 
> me. I didn't know that I can use if-statements in my FaxDispatch, too.

Hi Sebastian,

I'm afraid there is some misunderstanding. I suppose, Bodo meant this:

The basic syntax of a "case" statement is

case <expr> in
  <label1>)
     <command list>
     ;;
  <label2>)
     <command list>
     ;;
  <label3>)
     <command list>
     ;;

  <labeln>)
     <command list>
     ;;
  *)                   # matches all othe values, may be omitted
     <command list>
     ;;
esac

where all terms in <> mean a valid expression or constant. Depending from the resulting value of <expr> the program flow goes directly to the matching label and continues from there to the "break" statement ';;'.

So your code

case "$SENDER" in *11112222) mv $FULLPATH /var/spool/hylafax/recvq/2222-Dep1/;;
esac
# Dep2
case "$SENDER" in *33334444) mv $FULLPATH /var/spool/hylafax/recvq/4444-Dep2/;;
esac
# Dep3
case "$SENDER" in *55556666) mv $FULLPATH /var/spool/hylafax/recvq/6666-Dep3/;;
esac

is a sequence of case-statements with only one label, which is exactly equivalent to an if-statement.
To make use of the possibilities of "case" it should have been

case "$SENDER" in
  *11112222)
    mv $FULLPATH /var/spool/hylafax/recvq/2222-Dep1/
    ;;
  *33334444)
    mv $FULLPATH /var/spool/hylafax/recvq/4444-Dep2/
    ;;
  *55556666)
    mv $FULLPATH /var/spool/hylafax/recvq/6666-Dep3/
    ;;
esac

Kind regards

Stefan


____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions