<?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 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780718#M77103</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Flip around the test after the "-a"&lt;BR /&gt;&lt;BR /&gt;What happens??&lt;BR /&gt;&lt;BR /&gt;Chris</description>
    <pubDate>Tue, 06 Aug 2002 15:50:17 GMT</pubDate>
    <dc:creator>Christopher McCray_1</dc:creator>
    <dc:date>2002-08-06T15:50:17Z</dc:date>
    <item>
      <title>script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780715#M77100</link>
      <description>Hey guys, what am I doing wrong with the script. please help. I'm getting syntax error on line 12, 16, 20.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Greets $LOGNAME or a specified user&lt;BR /&gt;&lt;BR /&gt;#date=`data | cut -d\ -f4 |cut -d: -f1`&lt;BR /&gt;date=`date|awk '{print $4}'`&lt;BR /&gt;name=$1&lt;BR /&gt;if [ $# -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;        name=`finger -s -m $LOGNAME | head -2 |tail -1 |awk '{print $2}'`&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;        if [ $date -le 1 $date -a 11 -ge $date ]&lt;BR /&gt;        then&lt;BR /&gt;        echo Good Morning, $name&lt;BR /&gt;fi&lt;BR /&gt;        if [ $date  -le 12 $date -a 17 -ge $date ]&lt;BR /&gt;        then&lt;BR /&gt;        echo Good Afternoon, $name&lt;BR /&gt;fi&lt;BR /&gt;        if [ $date -le 18 $date -a 23 -ge $date ]&lt;BR /&gt;        then&lt;BR /&gt;        echo Good Evening, $name&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 15:44:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780715#M77100</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2002-08-06T15:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780716#M77101</link>
      <description>it should be:&lt;BR /&gt;&lt;BR /&gt;if [ $date -ge 1 -a $date -le 11 ]&lt;BR /&gt;&lt;BR /&gt;if [ $date -ge 12 -a $date -le 17 ]&lt;BR /&gt;&lt;BR /&gt;if [ $date -ge 18 -a $date -le 23 ]&lt;BR /&gt;&lt;BR /&gt;it reads like:&lt;BR /&gt;&lt;BR /&gt;if $date greater than or equal to 1 and $date less than or equal to 11, then ....&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Kenneth</description>
      <pubDate>Tue, 06 Aug 2002 15:49:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780716#M77101</guid>
      <dc:creator>Kenneth_19</dc:creator>
      <dc:date>2002-08-06T15:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780717#M77102</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Try to put echo statement in quotes&lt;BR /&gt;&lt;BR /&gt;echo "Good Morning"&lt;BR /&gt;&lt;BR /&gt;-USA..</description>
      <pubDate>Tue, 06 Aug 2002 15:49:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780717#M77102</guid>
      <dc:creator>Uday_S_Ankolekar</dc:creator>
      <dc:date>2002-08-06T15:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780718#M77103</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Flip around the test after the "-a"&lt;BR /&gt;&lt;BR /&gt;What happens??&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Tue, 06 Aug 2002 15:50:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780718#M77103</guid>
      <dc:creator>Christopher McCray_1</dc:creator>
      <dc:date>2002-08-06T15:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780719#M77104</link>
      <description>Still getting the same error about syntax ob line 12, 16, 20.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Greets $LOGNAME or a specified user&lt;BR /&gt;&lt;BR /&gt;#date=`data | cut -d\ -f4 |cut -d: -f1`&lt;BR /&gt;date=`date|awk '{print $4}'`&lt;BR /&gt;name=$1&lt;BR /&gt;if [ $# -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;        name=`finger -s -m $LOGNAME | head -2 |tail -1 |awk '{print $2}'`&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;        if [ $date -ge 1 -a $date -le 11 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "Good Morning", $name!&lt;BR /&gt;fi&lt;BR /&gt;        if [ $date  -ge 12 -a $date -le 17 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "Good Afternoon", $name!&lt;BR /&gt;fi&lt;BR /&gt;        if [ $date -ge 18 -a $date -le 23 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "Good Evening", $name!&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 16:09:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780719#M77104</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2002-08-06T16:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780720#M77105</link>
      <description>try running it a non root user!&lt;BR /&gt;&lt;BR /&gt;pereal - / # sh -x ./file&lt;BR /&gt;+ + awk {print $4}&lt;BR /&gt;+ date&lt;BR /&gt;date=18:26:02&lt;BR /&gt;+ name=&lt;BR /&gt;+ [ 0 -eq 0 ]&lt;BR /&gt;+ + finger -s -m root&lt;BR /&gt;+ head -2&lt;BR /&gt;+ awk {print $2}&lt;BR /&gt;+ tail -1&lt;BR /&gt;name=???&lt;BR /&gt;+ [ 18:26:02 -ge 1 -a 18:26:02 -le 11 ]&lt;BR /&gt;./file[12]: 18:26:02: Syntax error&lt;BR /&gt;+ [ 18:26:02 -ge 12 -a 18:26:02 -le 17 ]&lt;BR /&gt;./file[16]: 18:26:02: Syntax error&lt;BR /&gt;+ [ 18:26:02 -ge 18 -a 18:26:02 -le 23 ]&lt;BR /&gt;./file[20]: 18:26:02: Syntax error&lt;BR /&gt;pereal - / # finger -s -m root&lt;BR /&gt;Login       Name               TTY Idle    When    Bldg.         Phone&lt;BR /&gt;root            ???           *p1       Tue 18:25&lt;BR /&gt;&lt;BR /&gt;or...&lt;BR /&gt;you could filter the name variable for all special characters....&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Tue, 06 Aug 2002 16:13:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780720#M77105</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-08-06T16:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780721#M77106</link>
      <description>BTW, in line 5:&lt;BR /&gt;date=`date|awk '{print $4}'`&lt;BR /&gt;then date will be something like hh:mm:ss, therefore it will have error when comparing with integer in line 12, 16, and 20.&lt;BR /&gt;&lt;BR /&gt;Try change line 5 to:&lt;BR /&gt;date=`date|awk '{print $4}'|cut -d : -f 1`&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 16:14:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780721#M77106</guid>
      <dc:creator>Kenneth_19</dc:creator>
      <dc:date>2002-08-06T16:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780722#M77107</link>
      <description>Sanman&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The issue is in setting the date parameter , this sets it to 13:14:50 which also includes the second too , I have modified it to the follwoing :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh -x&lt;BR /&gt;# Greets $LOGNAME or a specified user &lt;BR /&gt;&lt;BR /&gt;#date=`data | cut -d\ -f4 |cut -d: -f1` &lt;BR /&gt;date=`date|awk '{print $4}'| cut -c 1-2` &lt;BR /&gt;name=$1 &lt;BR /&gt;if [ $# -eq 0 ] &lt;BR /&gt;then &lt;BR /&gt;name=`finger -s -m $LOGNAME | head -2 |tail -1 |awk '{print $2}'` &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;if [ $date -ge 1 -a $date -le 11 ]&lt;BR /&gt;&lt;BR /&gt;then &lt;BR /&gt;echo Good Morning, $name &lt;BR /&gt;fi &lt;BR /&gt;if [ $date -le 12 $date -a 17 -ge $date ] &lt;BR /&gt;then &lt;BR /&gt;echo Good Afternoon, $name &lt;BR /&gt;fi &lt;BR /&gt;if [ $date -le 18 $date -a 23 -ge $date ] &lt;BR /&gt;then &lt;BR /&gt;echo Good Evening, $name &lt;BR /&gt;&lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will work , also please use -x that is the debuuger mode so that you can exactly know waht the command is doing .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava</description>
      <pubDate>Tue, 06 Aug 2002 16:22:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780722#M77107</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-08-06T16:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780723#M77108</link>
      <description>oops!&lt;BR /&gt;I feel like I have to fix this before I go home now!&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Greets $LOGNAME or a specified user&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Greets $LOGNAME or a specified user&lt;BR /&gt;&lt;BR /&gt;hour=$(date  +'%H')&lt;BR /&gt;&lt;BR /&gt;name=bob&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if [ $hour -ge 18 ] ; then&lt;BR /&gt;echo "Good Evening", ${name}&lt;BR /&gt;exit 3&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ $hour -ge 12 ] ; then&lt;BR /&gt;echo "Good Afternoon", ${name}&lt;BR /&gt;exit 2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ $hour -ge 1 ] ; then&lt;BR /&gt;echo "Good Morning", ${name}&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;the problem is with the -a option...&lt;BR /&gt;&lt;BR /&gt;I'll work on it more,, sheesh my scripting has gone to the dogs..&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Tue, 06 Aug 2002 16:26:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780723#M77108</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-08-06T16:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780724#M77109</link>
      <description>Try this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Greets $LOGNAME or a specified user&lt;BR /&gt;&lt;BR /&gt;hour=$(date  +'%H')&lt;BR /&gt;name=bob&lt;BR /&gt;if [ $hour -ge 18 -a $hour -lt 24 ] ; then&lt;BR /&gt;echo "Good Evening", ${name}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ $hour -ge 12 -a $hour -lt 18 ] ; then&lt;BR /&gt;echo "Good Afternoon", ${name}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ $hour -ge 1 -a $hour -lt 12 ] ; then&lt;BR /&gt;echo "Good Morning", ${name}&lt;BR /&gt;fi</description>
      <pubDate>Tue, 06 Aug 2002 16:28:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780724#M77109</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-08-06T16:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780725#M77110</link>
      <description>I would still test for a valid name tho..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When run as root:&lt;BR /&gt;&lt;BR /&gt;Good Morning, bin dev etc lib log net opt tmp usr var &lt;BR /&gt;&lt;BR /&gt;pereal - / # echo ???&lt;BR /&gt;bin dev etc lib log net opt tmp usr var&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;pereal - / # finger -s -m root&lt;BR /&gt;Login       Name               TTY Idle    When    Bldg.         Phone&lt;BR /&gt;root            ???           *p1       Tue 18:25&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Tue, 06 Aug 2002 16:33:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780725#M77110</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-08-06T16:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780726#M77111</link>
      <description>Your script should have read like this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh &lt;BR /&gt;# Greets $LOGNAME or a specified user &lt;BR /&gt;&lt;BR /&gt;#date=`data | cut -d\ -f4 |cut -d: -f1` &lt;BR /&gt;date=`date|awk '{print $4}'|cut -d: -f1` &lt;BR /&gt;name=$1 &lt;BR /&gt;if [ $# -eq 0 ] &lt;BR /&gt;then &lt;BR /&gt;name=`finger -s -m $LOGNAME | head -2 |tail -1 |awk '{print $2}'` &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;if [ $date -ge 1 -a $date -le 11 ] &lt;BR /&gt;then &lt;BR /&gt;echo "Good Morning", $name! &lt;BR /&gt;fi &lt;BR /&gt;if [ $date -ge 12 -a $date -le 17 ] &lt;BR /&gt;then &lt;BR /&gt;echo "Good Afternoon", $name! &lt;BR /&gt;fi &lt;BR /&gt;if [ $date -ge 18 -a $date -le 23 ] &lt;BR /&gt;then &lt;BR /&gt;echo "Good Evening", $name! &lt;BR /&gt;&lt;BR /&gt;fi &lt;BR /&gt;</description>
      <pubDate>Tue, 06 Aug 2002 17:17:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2780726#M77111</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2002-08-06T17:17:04Z</dc:date>
    </item>
  </channel>
</rss>

