Changeset 12025


Ignore:
Timestamp:
2008-07-31T00:39:43+02:00 (8 years ago)
Author:
nbd
Message:

functions.sh: add list_contains function for checking whether a list contains a specific element

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/etc/functions.sh

    r12024 r12025  
    2323         
    2424        eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" 
     25} 
     26 
     27list_contains() { 
     28        local var="$1" 
     29        local str="$2" 
     30        local val 
     31 
     32        eval "val=\" \${$var} \"" 
     33        [ "${val%% $str *}" != "$val" ] 
    2534} 
    2635 
Note: See TracChangeset for help on using the changeset viewer.