<?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: script a timeout into a menu in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987462#M923404</link>
    <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;Instead of a simple 'read' use 'line -t timeout':&lt;BR /&gt;&lt;BR /&gt;# CHOICE=`line -t 10`&lt;BR /&gt;&lt;BR /&gt;See the man pages for 'line' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 03 Jun 2003 13:04:27 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2003-06-03T13:04:27Z</dc:date>
    <item>
      <title>script a timeout into a menu</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987461#M923403</link>
      <description>I'm trying to create a menu that will put a timeout into a menu and I'm not having much luck.  If the user does not interact in 10 seconds I want the script to choose a default choice for him/her.  Here is the script:&lt;BR /&gt;&lt;BR /&gt;function main {&lt;BR /&gt;tvar=10&lt;BR /&gt;while [ "$tvar" &amp;gt;= "0" ]&lt;BR /&gt;do&lt;BR /&gt;clear&lt;BR /&gt;echo "          ${BOLD}Main Boot Menu${NORMAL}"&lt;BR /&gt;echo " "&lt;BR /&gt;echo "         Please choose on of the following"&lt;BR /&gt;echo " "&lt;BR /&gt;echo "  ${BOLD}1${NORMAL} Default"&lt;BR /&gt;echo "  ${BOLD}2${NORMAL} N-1"&lt;BR /&gt;echo "  ${BOLD}3${NORMAL} R2"&lt;BR /&gt;echo " "&lt;BR /&gt;echo " you have ${BOLD}$tvar${NORMAL} seconds to make your selection before \"default\" is used"&lt;BR /&gt;sleep 1&lt;BR /&gt;((tvar=$tvar-1))&lt;BR /&gt;#done&lt;BR /&gt;&lt;BR /&gt;read choice&lt;BR /&gt;until [ "$choice" = "1" ] || [ "$choice" = "2" ] || [ "$choice" = "3" ] ;&lt;BR /&gt;do&lt;BR /&gt;echo "Please choose one of the options above"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;case $choice in&lt;BR /&gt;1)&lt;BR /&gt;default&lt;BR /&gt;;;&lt;BR /&gt;2)&lt;BR /&gt;N1&lt;BR /&gt;;;&lt;BR /&gt;3)&lt;BR /&gt;R2&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;done&lt;BR /&gt;default&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Jun 2003 12:59:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987461#M923403</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-03T12:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: script a timeout into a menu</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987462#M923404</link>
      <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;Instead of a simple 'read' use 'line -t timeout':&lt;BR /&gt;&lt;BR /&gt;# CHOICE=`line -t 10`&lt;BR /&gt;&lt;BR /&gt;See the man pages for 'line' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 03 Jun 2003 13:04:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987462#M923404</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-06-03T13:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: script a timeout into a menu</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987463#M923405</link>
      <description>James - Thanks ... that was exactly what I was looking for.  I was hoping to have a countdown clock display counting down the time remaining to make a selection but I'll take what  I can get...&lt;BR /&gt;&lt;BR /&gt;Here is the final script:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;function main {&lt;BR /&gt;clear&lt;BR /&gt;echo "          ${BOLD}Main Boot Menu${NORMAL}"&lt;BR /&gt;echo " "&lt;BR /&gt;echo "         Please choose on of the following"&lt;BR /&gt;echo " "&lt;BR /&gt;echo "  ${BOLD}1${NORMAL} Default - test and developement"&lt;BR /&gt;echo "  ${BOLD}2${NORMAL} Disaster Recovery N-1 copy for `hostname`"&lt;BR /&gt;echo "  ${BOLD}3${NORMAL} Disaster Recovery R2 copy for `hostname`"&lt;BR /&gt;echo " "&lt;BR /&gt;echo "You have 10 seconds to make a selection"&lt;BR /&gt;print -n "Please choose one of the options above:"&lt;BR /&gt;&lt;BR /&gt;choice=`line -t 10`&lt;BR /&gt;until [ "$choice" = "1" ] || [ "$choice" = "2" ] ||&lt;BR /&gt;      [ "$choice" = "3" ] || [ "$choice" = "" ] ;&lt;BR /&gt;do&lt;BR /&gt;print -n "Please choose one of the options above"&lt;BR /&gt;choice=`line -t 10`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if [ "$choice" = "" ] || [ "$choice" = "1" ] ;&lt;BR /&gt;then&lt;BR /&gt;default&lt;BR /&gt;elif [ "$choice" = "2" ]&lt;BR /&gt;then&lt;BR /&gt;N1&lt;BR /&gt;elif [ "$choice" = "3" ]&lt;BR /&gt;then&lt;BR /&gt;R2&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Jun 2003 14:53:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-a-timeout-into-a-menu/m-p/2987463#M923405</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-03T14:53:23Z</dc:date>
    </item>
  </channel>
</rss>

