<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
Exactly how does not assign a list of values separated by pipe to use that variable later on in a script and make a CASE statement happy? <BR>
The script below shows a variety of attempts. <BR>
<BR>
Ultimately, we're aiming to grab the list from a file, eg "LIST="`cat allow.list`"<BR>
<BR>
<BR>
<BLOCKQUOTE>
REMOTE_ADDR=one<BR>
<BR>
case $REMOTE_ADDR in<BR>
one|two|three) echo "I like $REMOTE_ADDR" ;; # Picks this one.<BR>
*) echo "I do NOT like $REMOTE_ADDR" ;;<BR>
esac<BR>
<BR>
LIST="one|two|three"<BR>
case $REMOTE_ADDR in<BR>
$LIST) echo "But now I like $REMOTE_ADDR" ;;<BR>
*) echo "But now I do NOT like $REMOTE_ADDR" ;; # Picks this one.<BR>
esac<BR>
<BR>
case $REMOTE_ADDR in<BR>
"$LIST") echo "And I like $REMOTE_ADDR" ;;<BR>
*) echo "And I do NOT like $REMOTE_ADDR" ;; # Picks this one.<BR>
esac<BR>
<BR>
LIST="one"<BR>
case $REMOTE_ADDR in<BR>
"$LIST") echo "Yet I like $REMOTE_ADDR" ;; # Picks this one.<BR>
*) echo "Yet I do NOT like $REMOTE_ADDR" ;;<BR>
esac<BR>
<BR>
LIST="one\|two\|three"<BR>
case $REMOTE_ADDR in<BR>
$LIST) echo "However now I like $REMOTE_ADDR" ;;<BR>
*) echo "However now I do NOT like $REMOTE_ADDR" ;; # Picks this one.<BR>
esac<BR>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>