<?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 problem in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931025#M46216</link>
    <description>It looks like the space left between values was the issue.&lt;BR /&gt;Thanks everyone.</description>
    <pubDate>Tue, 04 Oct 2005 13:54:09 GMT</pubDate>
    <dc:creator>Alain Tesserot</dc:creator>
    <dc:date>2005-10-04T13:54:09Z</dc:date>
    <item>
      <title>script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931017#M46208</link>
      <description>If I use&lt;BR /&gt;grep `date +%a", "%e" "%b" "%G` /home/erd_manager/Inbox |wc -l&lt;BR /&gt;I get a positive value back but when using the script bellow I get 0 even though echo $express_var is set. What's wrong with the script?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;express_var=`date +%a", "%e" "%b" "%G`&lt;BR /&gt;express_var="Date: "$express_var&lt;BR /&gt;echo $express_var&lt;BR /&gt;grep '$express_var' /home/erd_manager/Inbox |wc -l</description>
      <pubDate>Mon, 03 Oct 2005 19:04:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931017#M46208</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-10-03T19:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931018#M46209</link>
      <description>last line:&lt;BR /&gt;grep '$express_var' will not work because single quote does not evaluate variable; replace it with double quote and it should work.</description>
      <pubDate>Mon, 03 Oct 2005 19:08:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931018#M46209</guid>
      <dc:creator>K.C. Chan</dc:creator>
      <dc:date>2005-10-03T19:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931019#M46210</link>
      <description>The double quotes didn't work either.</description>
      <pubDate>Mon, 03 Oct 2005 19:14:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931019#M46210</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-10-03T19:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931020#M46211</link>
      <description>Alain,&lt;BR /&gt;&lt;BR /&gt;Did some playing, on my system this happens.&lt;BR /&gt;&lt;BR /&gt;The output of the command itself looks like this:&lt;BR /&gt;&lt;BR /&gt;$ date +%a", "%e" "%b" "%G      &lt;BR /&gt;Tue,  4 Oct 2005&lt;BR /&gt;&lt;BR /&gt;The output of putting it into a variable and echo'ing looks like this:&lt;BR /&gt;&lt;BR /&gt;$ var=`date +%a", "%e" "%b" "%G`&lt;BR /&gt;$ echo $var                     &lt;BR /&gt;Tue, 4 Oct 2005&lt;BR /&gt;&lt;BR /&gt;Notice how when there is a double space in the actual command output i.e. "Tue,  4 Oct" and in the echo $var output it looks like "Tue, 4 Oct"... there is a space missing.&lt;BR /&gt;&lt;BR /&gt;Confirm this is the same on your system and you might have found the problem... the missing space!&lt;BR /&gt;&lt;BR /&gt;Since you say you can run it manually and get a result I'm going to assume your "Inbox" file has the date like "Tue,  4 Oct" if the date is less than 10. %e to date will add an extra space if the date is less than 10 and this extra space goes missing when placed into a variable... for some unknown reason. I've looked at it for a while and can't for the life of me figure out why... no doubt overlooking something obvious.&lt;BR /&gt;&lt;BR /&gt;If you can't find a way to stop it from doing this script around it... if the date is less than 10 manually insert the space back in or something.&lt;BR /&gt;&lt;BR /&gt;Also the previous poster is 100% correct, single quotes around the variable won't work in the grep due to them not evaluating the variable but using $express_var as a literal string to search for...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Oct 2005 20:34:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931020#M46211</guid>
      <dc:creator>Michael Jorgensen</dc:creator>
      <dc:date>2005-10-03T20:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931021#M46212</link>
      <description>Ok something strange going on... should learn to preview my posts.&lt;BR /&gt;&lt;BR /&gt;The command output should look like this:&lt;BR /&gt;&lt;BR /&gt;$ date "+%a, %e %b %G"&lt;BR /&gt;Tue,  4 Oct 2005&lt;BR /&gt;&lt;BR /&gt;My previous post makes it looks like there is only one space... GRRR... even though there is quite clearly two space even in this one the forum post is only showing one in the preview! Something buggy going on.&lt;BR /&gt;&lt;BR /&gt;Which makes it possible that a similar thing happened to you when you were pasting in your commands and I see only one space when you used multiple spaces or something.&lt;BR /&gt;&lt;BR /&gt;Hopefully my reply makes sense... if it doesn't I've attached a text file with what I was trying to show which will, hopefully, not be modified by the forum when I post it.</description>
      <pubDate>Mon, 03 Oct 2005 20:38:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931021#M46212</guid>
      <dc:creator>Michael Jorgensen</dc:creator>
      <dc:date>2005-10-03T20:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931022#M46213</link>
      <description>That was a pretty good catch. I'll check it out at the office in the morning.</description>
      <pubDate>Mon, 03 Oct 2005 20:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931022#M46213</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-10-03T20:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931023#M46214</link>
      <description>single quote will not work.&lt;BR /&gt;&lt;BR /&gt;# date +%a", "%e" "%b" "%G&lt;BR /&gt;Mon,  3 Oct 2005&lt;BR /&gt;&lt;BR /&gt;# echo "Mon,  3 Oct 2005" | grep '`date +%a", "%e" "%b" "%G`'&lt;BR /&gt;&lt;BR /&gt;Use double quote:&lt;BR /&gt;# echo "Mon,  3 Oct 2005" | grep "`date +%a", "%e" "%b" "%G`"&lt;BR /&gt;Mon,  3 Oct 2005&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 04 Oct 2005 01:01:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931023#M46214</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-04T01:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931024#M46215</link>
      <description>You can also store into a variable and search it as,&lt;BR /&gt;&lt;BR /&gt;var=`date +%a", "%e" "%b" "%G`&lt;BR /&gt;grep "$var" &lt;FILENAME&gt; | wc -l&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/FILENAME&gt;</description>
      <pubDate>Tue, 04 Oct 2005 02:32:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931024#M46215</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-04T02:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931025#M46216</link>
      <description>It looks like the space left between values was the issue.&lt;BR /&gt;Thanks everyone.</description>
      <pubDate>Tue, 04 Oct 2005 13:54:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/4931025#M46216</guid>
      <dc:creator>Alain Tesserot</dc:creator>
      <dc:date>2005-10-04T13:54:09Z</dc:date>
    </item>
  </channel>
</rss>

