<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help with LIKE operator or $GROUP variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414199#M706833</link>
    <description>I'd like to thank you both for the quick response to my question.  The one that worked best for my situation was &lt;BR /&gt;&lt;BR /&gt;GROUP = $(groups -d $LOGNAME)&lt;BR /&gt;&lt;BR /&gt;if [$GROUP=support]&lt;BR /&gt;   then ...&lt;BR /&gt;&lt;BR /&gt;Staci</description>
    <pubDate>Wed, 03 Nov 2004 18:57:40 GMT</pubDate>
    <dc:creator>Staci Tribelhorn</dc:creator>
    <dc:date>2004-11-03T18:57:40Z</dc:date>
    <item>
      <title>Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414195#M706829</link>
      <description>I'm trying to fix the a profile script and would like to validate against a unix group instead of username.  Is there a variable that will allow me to do this?  Below is a portion of the script as it is currently written.  &lt;BR /&gt;&lt;BR /&gt;if   [ "$LOGNAME" = "user1"]  &lt;BR /&gt;&lt;BR /&gt;I'd like to change this to either &lt;BR /&gt;"$GROUPNAME =" OR "$LOGNAME like".  &lt;BR /&gt;&lt;BR /&gt;Thanks for any assistance,&lt;BR /&gt;Staci</description>
      <pubDate>Wed, 03 Nov 2004 13:07:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414195#M706829</guid>
      <dc:creator>Staci Tribelhorn</dc:creator>
      <dc:date>2004-11-03T13:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414196#M706830</link>
      <description>Don't think so, but you could find out the primary group:&lt;BR /&gt;&lt;BR /&gt;GROUP = `groups $LOGNAME |awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;if [ "$GROUP" = "adm"] &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;...etc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Nov 2004 13:14:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414196#M706830</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-11-03T13:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414197#M706831</link>
      <description>If you're only interested in a user's primary group, then `id -gn` would be helpful. Perhaps case statements would also be useful.&lt;BR /&gt;&lt;BR /&gt;case "$(id -gn)" in&lt;BR /&gt;(grp1) ... ;;&lt;BR /&gt;(grp2) ... ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;If you need to look at all of the user's groups, then `groups` would be more appropriate.&lt;BR /&gt;&lt;BR /&gt;for g in $(groups); do&lt;BR /&gt;case "$g" in&lt;BR /&gt;(grp1) ... ;;&lt;BR /&gt;(grp2) ... ;;&lt;BR /&gt;esac&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;For simple matching of similar usernames, like user123, user124, etc, try this:&lt;BR /&gt;&lt;BR /&gt;if [ "${LOGNAME%[0-9][0-9][0-9]}" == "user" ]&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;case "$LOGNAME" in&lt;BR /&gt;(user*) ... ;;&lt;BR /&gt;(*tst) ... ;;&lt;BR /&gt;([a-z][0-9]admin?) ... ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Nov 2004 13:29:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414197#M706831</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2004-11-03T13:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414198#M706832</link>
      <description>Jordan's right - id -gn will retrive primary group, or modify mine to be:&lt;BR /&gt;&lt;BR /&gt;groups -p $LOGNAME&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 03 Nov 2004 13:41:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414198#M706832</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-11-03T13:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414199#M706833</link>
      <description>I'd like to thank you both for the quick response to my question.  The one that worked best for my situation was &lt;BR /&gt;&lt;BR /&gt;GROUP = $(groups -d $LOGNAME)&lt;BR /&gt;&lt;BR /&gt;if [$GROUP=support]&lt;BR /&gt;   then ...&lt;BR /&gt;&lt;BR /&gt;Staci</description>
      <pubDate>Wed, 03 Nov 2004 18:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414199#M706833</guid>
      <dc:creator>Staci Tribelhorn</dc:creator>
      <dc:date>2004-11-03T18:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with LIKE operator or $GROUP variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414200#M706834</link>
      <description>&amp;gt;&amp;gt; I'd like to thank you both for the quick response to my question.&lt;BR /&gt;&lt;BR /&gt;Don't just thank them... give them some points! :-).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; The one that worked best for my situation was : GROUP = $(groups -d $LOGNAME)&lt;BR /&gt;&lt;BR /&gt;Uh.... that's a typo right? -d really is -p.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;btw... if you are really concerned about a user being part of multipel groups (root), then you may want to try something like:&lt;BR /&gt;&lt;BR /&gt;if groups $LOGNAME | grep -q support ; then echo "yes"; else echo "no"; fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Nov 2004 19:26:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-with-like-operator-or-group-variable/m-p/3414200#M706834</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-11-03T19:26:30Z</dc:date>
    </item>
  </channel>
</rss>

