<?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: need help with scriping in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026919#M909883</link>
    <description>Usually input is from STDIN and you can do the following-&lt;BR /&gt;&lt;BR /&gt;echo "1" | ./life1&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Thu, 17 Jul 2003 20:55:07 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2003-07-17T20:55:07Z</dc:date>
    <item>
      <title>need help with scriping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026918#M909882</link>
      <description>I have to put a startup script in the init.d to start an application, please help...for instance :&lt;BR /&gt;cd /usr/home/life&lt;BR /&gt;./life1 &amp;lt;--- give you a menu where you have to select a number.  &lt;BR /&gt;1.yes&lt;BR /&gt;2.no&lt;BR /&gt;** how can i write it in such, it will automatically pick 1 instead of waiting for the user?&lt;BR /&gt;Please help</description>
      <pubDate>Thu, 17 Jul 2003 20:51:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026918#M909882</guid>
      <dc:creator>hi_5</dc:creator>
      <dc:date>2003-07-17T20:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: need help with scriping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026919#M909883</link>
      <description>Usually input is from STDIN and you can do the following-&lt;BR /&gt;&lt;BR /&gt;echo "1" | ./life1&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 17 Jul 2003 20:55:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026919#M909883</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-07-17T20:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: need help with scriping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026920#M909884</link>
      <description>It sounds as if you need to use the "line" command as this allows you to specify a timeout period, specified in seconds. &lt;BR /&gt;&lt;BR /&gt;If the following example script is run interactively, the user is given a window in which to make a decision, else it will apply a default.  If you take this approach, make sure the default value will not perform any unwanted actions.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/env ksh&lt;BR /&gt;&lt;BR /&gt;echo "Please enter Y to continue (default=N) \c"&lt;BR /&gt;REPLY="$(line -t 30)"&lt;BR /&gt;case ${REPLY:="N"} in&lt;BR /&gt;     Y|y)     echo "Y was selected !!"&lt;BR /&gt;              ;;&lt;BR /&gt;     N|n)     echo "N was selected !!"&lt;BR /&gt;              ;;&lt;BR /&gt;     *)       echo "Invalid option !!"&lt;BR /&gt;              ;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Another alternative would be to check to see if the script is being run in an interactive session - if not, apply a default.  For example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/env ksh&lt;BR /&gt;&lt;BR /&gt;if [ "$(ttytype)" = "" ]&lt;BR /&gt;then&lt;BR /&gt;     # Non interactive session - ie cron or rc !&lt;BR /&gt;     echo "Default of N has been applied !!"&lt;BR /&gt;else&lt;BR /&gt;     echo "Enter 1 or 2 \c"&lt;BR /&gt;     read REPLY&lt;BR /&gt;     case ......&lt;BR /&gt;etc etc etc etc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Give that ago - they may allow you to do what you want within your scripts !!&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Paul&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2003 21:08:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026920#M909884</guid>
      <dc:creator>Paul Murray_4</dc:creator>
      <dc:date>2003-07-17T21:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: need help with scriping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026921#M909885</link>
      <description>Whatever value the script is waiting for the user to enter is probably read into a variable...just comment out the part where it asks the user the question, and hard code the varible to 1.</description>
      <pubDate>Thu, 17 Jul 2003 21:25:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scriping/m-p/3026921#M909885</guid>
      <dc:creator>Kevin Wright</dc:creator>
      <dc:date>2003-07-17T21:25:21Z</dc:date>
    </item>
  </channel>
</rss>

