I posted three responses with the wrong email address:
==================================================================================================== You could do something else entirely, like: larry$ a=a larry$ echo $list a|b|c larry$ [[ $list =~ $a ]] && echo hi || echo ho hi larry$ a=d larry$ [[ $list =~ $a ]] && echo hi || echo ho ho or [[ "$(ls /clamscan/servers)" =~ $target_system ]] && parm_1="valid" (assuming no system name is a subset of another system name. Otherwise: [[ "$(ls /clamscan/servers)" =~ " $target_system " ]] && parm_1="valid" to ensure $target_system matches exactly and all of one file name in /clamscan/servers, but the $target_system token has to be in the first column. or, of course, you could go the direct route: [[ -f /clamscan/servers/$target_system ]] && parm_1="valid" ==================================================================================================== Fargusson.Alan wrote:
The problem is that bash takes cooked_list as a single token in the case statement. It matches the entire list of systems, and not each member of the list. I don't know of any way around this. You will probably need to do another for loop on raw_list and check for a match in the loop.
This is where eval comes in handy: larry$ bash -c 'set -x; list="a|b|c"; t=a; eval "case $t in ( $list ) echo one;; b ) echo two;; esac' + list='a|b|c' + t=a + eval 'case a in ( a|b|c ) echo one;; b ) echo two;; esac' ++ case a in ++ echo one one (although James would still have the problem of one system name being a subset of another system name.) ==================================================================================================== Mark Post wrote:
If that doesn't help, then put a "set -x" right after the #!/bin/sh line, and send the output, along with the command invocation.
or put "-x" on the shebang line: #! /bin/sh -x ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390