<?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: Validations for read? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824583#M940422</link>
    <description>I just noticed you "korn" shell reply.  The "korn" shell is the best one to use in most cases.  It has a lot of commands.  The "typeset" is one of them so you would need to insert the "#!/bin/ksh" line at the top.</description>
    <pubDate>Mon, 14 Oct 2002 11:50:22 GMT</pubDate>
    <dc:creator>Thomas M. Williams_1</dc:creator>
    <dc:date>2002-10-14T11:50:22Z</dc:date>
    <item>
      <title>Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824575#M940414</link>
      <description>I need some help here.&lt;BR /&gt;script1.sh&lt;BR /&gt;-----------&lt;BR /&gt;echo "Enter a number: \c"&lt;BR /&gt;read num1&lt;BR /&gt;&lt;BR /&gt;i want to only num1 accepts number (ex: 1, 2, 4). But if i enter (enter key, backspace key, spacebar key). The output will be different. Any sample validations to avoid this. Thank you.</description>
      <pubDate>Sun, 13 Oct 2002 04:18:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824575#M940414</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-13T04:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824576#M940415</link>
      <description>if the shell your using supports character classes, you can do&lt;BR /&gt;if [[ $num1 == [:alnum:] ]] ;then&lt;BR /&gt;&lt;BR /&gt;but it probably doesn't, so you'll need to do something like this&lt;BR /&gt;&lt;BR /&gt;if [[ $num1 == [a-zA-Z0-9] ]] ;then</description>
      <pubDate>Sun, 13 Oct 2002 05:43:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824576#M940415</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2002-10-13T05:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824577#M940416</link>
      <description>just numbers would be&lt;BR /&gt;[:digit:] or [0-9]&lt;BR /&gt;hex numbers&lt;BR /&gt;[:xdigit:] or [0-9a-fA-F]&lt;BR /&gt;just certain digits&lt;BR /&gt;[159] etc</description>
      <pubDate>Sun, 13 Oct 2002 05:49:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824577#M940416</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2002-10-13T05:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824578#M940417</link>
      <description>I had some confusion with the solution you reply, can you show me a short and simple sample script. Thank you.</description>
      <pubDate>Sun, 13 Oct 2002 09:58:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824578#M940417</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-13T09:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824579#M940418</link>
      <description>#!/usr/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;found=false&lt;BR /&gt;while [ "${found}" = "false" ] ;do&lt;BR /&gt;echo "enter num:\c"&lt;BR /&gt;read num1&lt;BR /&gt;if [[ "${num1}" = [124] ]];then&lt;BR /&gt;found=true&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Sun, 13 Oct 2002 12:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824579#M940418</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-10-13T12:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824580#M940419</link>
      <description>Hmm...i do not know much about korn shell. Is there any sample script on bourne shell scripting? Thank you.</description>
      <pubDate>Sun, 13 Oct 2002 15:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824580#M940419</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-13T15:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824581#M940420</link>
      <description>simply type set a variable.&lt;BR /&gt;&lt;BR /&gt;typeset -i num1&lt;BR /&gt;&lt;BR /&gt;It error out on anything other than a number.</description>
      <pubDate>Mon, 14 Oct 2002 11:44:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824581#M940420</guid>
      <dc:creator>Thomas M. Williams_1</dc:creator>
      <dc:date>2002-10-14T11:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824582#M940421</link>
      <description>I am sure you would do this anyway but check the man page on "typeset".  It is an extremely useful command.</description>
      <pubDate>Mon, 14 Oct 2002 11:48:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824582#M940421</guid>
      <dc:creator>Thomas M. Williams_1</dc:creator>
      <dc:date>2002-10-14T11:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824583#M940422</link>
      <description>I just noticed you "korn" shell reply.  The "korn" shell is the best one to use in most cases.  It has a lot of commands.  The "typeset" is one of them so you would need to insert the "#!/bin/ksh" line at the top.</description>
      <pubDate>Mon, 14 Oct 2002 11:50:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824583#M940422</guid>
      <dc:creator>Thomas M. Williams_1</dc:creator>
      <dc:date>2002-10-14T11:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824584#M940423</link>
      <description>When i man typeset, it displays no manual entry for typeset. Is it part of HP-UX 10.20. Can you show me an sample bourne shell script that utilizes typeset? Thank you.</description>
      <pubDate>Mon, 14 Oct 2002 11:53:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824584#M940423</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-14T11:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824585#M940424</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The 'typeset' command is part of the shell.  You can find out about it in the man pages for 'ksh' and 'sh-posix', just search for typeset.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Oct 2002 11:58:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824585#M940424</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-10-14T11:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824586#M940425</link>
      <description>Okay i will make research on the typeset. Do you mind show me a sample of ksh/posix using the typeset feature? Thank you.</description>
      <pubDate>Mon, 14 Oct 2002 14:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824586#M940425</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-14T14:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824587#M940426</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here is a quick sample of using typeset that I put together.  This sample fills the variable with zeros:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;cat typeset.test.ksh   &lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;# typeset.test.ksh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;typeset -Z8 zeros=0&lt;BR /&gt;&lt;BR /&gt;echo "zeros is $zeros"&lt;BR /&gt;&lt;BR /&gt;zeros=123&lt;BR /&gt;&lt;BR /&gt;echo "zeros is $zeros"&lt;BR /&gt;&lt;BR /&gt;&amp;gt;./typeset.test.ksh&lt;BR /&gt;zeros is 00000000&lt;BR /&gt;zeros is 00000123&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Oct 2002 14:25:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824587#M940426</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2002-10-14T14:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824588#M940427</link>
      <description>echo " enter a number "&lt;BR /&gt;until [ "$answer" = [:digit:] ] ; do&lt;BR /&gt;        echo " Answer with a number !\c"&lt;BR /&gt;        read answer</description>
      <pubDate>Mon, 14 Oct 2002 14:44:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824588#M940427</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2002-10-14T14:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824589#M940428</link>
      <description>Thanks for the typeset script. I think it really can help in validations. Thank you.</description>
      <pubDate>Mon, 14 Oct 2002 14:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824589#M940428</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-14T14:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824590#M940429</link>
      <description>at the end of the above script you need to put one more line at the end:&lt;BR /&gt;&lt;BR /&gt;done</description>
      <pubDate>Mon, 14 Oct 2002 14:48:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824590#M940429</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2002-10-14T14:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824591#M940430</link>
      <description>Hmm....i had some confusion here when running the sample script. &lt;BR /&gt;The output:&lt;BR /&gt;-----------&lt;BR /&gt;enter a number&lt;BR /&gt;Answer with a number!1&lt;BR /&gt;Answer with a number!b&lt;BR /&gt;Answer with a number!3&lt;BR /&gt;endless loop&lt;BR /&gt;&lt;BR /&gt;It seems like cannot work to me. Anyway thanks for your help. Do i need to replace :digit: to :4: or :1:???</description>
      <pubDate>Mon, 14 Oct 2002 14:52:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824591#M940430</guid>
      <dc:creator>Chua Wen Ching</dc:creator>
      <dc:date>2002-10-14T14:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Validations for read?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824592#M940431</link>
      <description>try replacing the [:digit:] with:&lt;BR /&gt;&lt;BR /&gt;[0-9]&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Oct 2002 14:55:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/validations-for-read/m-p/2824592#M940431</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2002-10-14T14:55:37Z</dc:date>
    </item>
  </channel>
</rss>

