<?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 script: case in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913778#M107906</link>
    <description>Hi,&lt;BR /&gt;I need to do a script using case.&lt;BR /&gt;(case ... in  )&lt;BR /&gt;Could someone give me an example?&lt;BR /&gt;&lt;BR /&gt;thank you&lt;BR /&gt;</description>
    <pubDate>Wed, 26 Feb 2003 14:15:05 GMT</pubDate>
    <dc:creator>andrea_53</dc:creator>
    <dc:date>2003-02-26T14:15:05Z</dc:date>
    <item>
      <title>script: case</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913778#M107906</link>
      <description>Hi,&lt;BR /&gt;I need to do a script using case.&lt;BR /&gt;(case ... in  )&lt;BR /&gt;Could someone give me an example?&lt;BR /&gt;&lt;BR /&gt;thank you&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Feb 2003 14:15:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913778#M107906</guid>
      <dc:creator>andrea_53</dc:creator>
      <dc:date>2003-02-26T14:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: script: case</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913779#M107907</link>
      <description>Here is some example case usage that we use to test conditions for a backup:&lt;BR /&gt;&lt;BR /&gt;# TEST FOR CORRECT USAGE:&lt;BR /&gt;#                                       # Ensure root is executing the script&lt;BR /&gt;UID=`/usr/bin/id -u`                    # Test the user id&lt;BR /&gt;case "$UID" in                          # Is it root?&lt;BR /&gt;     0)                                 # Do nothing user is root&lt;BR /&gt;        ;;                              # Otherwise...&lt;BR /&gt;     *) echo "$BELL"                    # Ring the bell&lt;BR /&gt;        echo "$USAGE"                   # Display the usage message&lt;BR /&gt;        exit 1;                         # Abort the script&lt;BR /&gt;esac&lt;BR /&gt;#                                       # Test the number of arguments&lt;BR /&gt;case "$#" in                            # How many arguments passed?&lt;BR /&gt;     1)                                 # Do nothing this is correct&lt;BR /&gt;        ;;                              # Otherwise...&lt;BR /&gt;     *) echo "$BELL"                    # Ring the bell&lt;BR /&gt;        echo "$USAGE"                   # Display the usage message&lt;BR /&gt;        exit 1;;                        # Abort the script&lt;BR /&gt;esac&lt;BR /&gt;#                                       # Test the argument passed&lt;BR /&gt;case "$1" in                            # What is the argument set to?&lt;BR /&gt;    -o|-O) ;;                           # Undocumented see below&lt;BR /&gt;    -f|-F) MODE="Full";;                # Set up for weekly full backup&lt;BR /&gt;    -i|-I) MODE="Incremental";;         # Set up for daily incremental backup&lt;BR /&gt;    -m|-M) MODE="MonthEnd"              # Set up for month end full backup&lt;BR /&gt;        ;;                              # Otherwise...&lt;BR /&gt;     *) echo "$BELL"                    # Ring the bell&lt;BR /&gt;        echo "$USAGE"                   # Display the usage message&lt;BR /&gt;        exit 1;;                        # Abort the script&lt;BR /&gt;esac&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Feb 2003 14:17:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913779#M107907</guid>
      <dc:creator>Ross Zubritski</dc:creator>
      <dc:date>2003-02-26T14:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: script: case</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913780#M107908</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;  echo "input: \c"&lt;BR /&gt;  read var&lt;BR /&gt;  case "$var"&lt;BR /&gt;  in&lt;BR /&gt;    1)&lt;BR /&gt;      echo 1;;&lt;BR /&gt;    2) &lt;BR /&gt;      echo 2;;&lt;BR /&gt;    *)&lt;BR /&gt;      echo "something else";;&lt;BR /&gt;  esac&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 26 Feb 2003 14:17:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913780#M107908</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2003-02-26T14:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: script: case</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913781#M107909</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;echo "would you like a drink  Yy or Nn \c"&lt;BR /&gt;read ans&lt;BR /&gt;case $ans in&lt;BR /&gt;&lt;BR /&gt;Y|y) echo "I'll put the kettle on"&lt;BR /&gt;;;&lt;BR /&gt;n|N) echo "Ok"&lt;BR /&gt;;;&lt;BR /&gt;*) echo " Please reply Yy Nn "&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can see the actions are dependant upon the replay of the question&lt;BR /&gt;&lt;BR /&gt;The construct is straight forward but obviously gets more complicated as you require more actions to be performed&lt;BR /&gt;&lt;BR /&gt;Have a look here for tonnes of reference areas&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/0,,0xbb5e7e990647d4118fee0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/0,,0xbb5e7e990647d4118fee0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Feb 2003 14:24:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-case/m-p/2913781#M107909</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2003-02-26T14:24:44Z</dc:date>
    </item>
  </channel>
</rss>

