<?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: Using a file with messages and using in the message with commands in a function ... in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949355#M103274</link>
    <description>o.k. thanks,&lt;BR /&gt;i'm going to explain you exactly how script looks like:&lt;BR /&gt;&lt;BR /&gt;File named messages:&lt;BR /&gt;001#`date=+'%Y%m%d'`=DEPURACION:=$vv=bytes=from=$hora=inicial=to=$hora=final&lt;BR /&gt;002#`date=+'%Y%m%d'`=$vv=bytes=deleted=from=$horainicial=to=$horafinal&lt;BR /&gt;003#`date=+'%Y%m%d'`=There=are=not=core=files=to=be=deleted&lt;BR /&gt;004#`date=+'%Y%m%d'`=PROBLEMS=TO=DELETE=FILES=$v=bytes=con=$r2&lt;BR /&gt;005#"CORE=FILES"&lt;BR /&gt;&lt;BR /&gt;Function:&lt;BR /&gt;function notifica&lt;BR /&gt;{&lt;BR /&gt;one=`echo $1 | sed 's/=/ /g'`&lt;BR /&gt;two=`echo $2 | sed 's/=/ /g'`&lt;BR /&gt;three=`echo $3 | sed 's/=/ /g'`&lt;BR /&gt;echo "$one" &amp;gt;&amp;gt; ${log_monitoring} #Sending message to log&lt;BR /&gt;echo "$two" | mailx -s "$three" 123456789@patito.com #Sending message to cellular&lt;BR /&gt;#echo "$three" &amp;gt; /dev/console #Sending message to server console&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;If i see $log_monitoring has:&lt;BR /&gt;..........&lt;BR /&gt;..........&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;&lt;BR /&gt;What do i must do for format date appears correctly and not the command `date +'%Y%m%d'` ?&lt;BR /&gt;&lt;BR /&gt;Thanks, Manuales.</description>
    <pubDate>Thu, 29 Dec 2005 18:11:15 GMT</pubDate>
    <dc:creator>Manuales</dc:creator>
    <dc:date>2005-12-29T18:11:15Z</dc:date>
    <item>
      <title>Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949351#M103270</link>
      <description>Hi .. &lt;BR /&gt;i have a file where there are messages:&lt;BR /&gt;&lt;BR /&gt;001#$(date) This is message one with $valor files&lt;BR /&gt;002#$(date) There are $v files on $v path&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;in other file i obtain the message, it depends the case:&lt;BR /&gt;&lt;BR /&gt;one=`cat messages.txt | grep 001 | cut -d"#" -f2`&lt;BR /&gt;&lt;BR /&gt;i invoke a function named hola&lt;BR /&gt;hola $one&lt;BR /&gt;&lt;BR /&gt;function hola contains:&lt;BR /&gt;echo $1 &lt;BR /&gt;&lt;BR /&gt;and the result is:&lt;BR /&gt;$(date) This is message one&lt;BR /&gt;&lt;BR /&gt;and it mus be:&lt;BR /&gt;&lt;BR /&gt;Thu Dec 29 16:17:06 MET 2005 This is a message one with 300 files.&lt;BR /&gt;&lt;BR /&gt;Why it can not shown date?&lt;BR /&gt;&lt;BR /&gt;Thanks, Manuales.</description>
      <pubDate>Thu, 29 Dec 2005 17:19:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949351#M103270</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-29T17:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949352#M103271</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;You need to use 'eval' :&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;one=`cat messages.txt | grep 001 | cut -d"#" -f2`&lt;BR /&gt;valor=13&lt;BR /&gt;function hola&lt;BR /&gt;{&lt;BR /&gt;    eval echo $@ #...note!&lt;BR /&gt;}&lt;BR /&gt;hola $one&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Notice that instead of $1 I used $@ since I (and you) wanted the whole string, not just the first argument passed to 'hola'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 29 Dec 2005 17:37:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949352#M103271</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-29T17:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949353#M103272</link>
      <description>i did not understand very well ..&lt;BR /&gt;do i have next? :&lt;BR /&gt;&lt;BR /&gt;function hola&lt;BR /&gt;{&lt;BR /&gt;eval echo $@1&lt;BR /&gt;or&lt;BR /&gt;eval echo $@#1&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;thanks my friend !!!</description>
      <pubDate>Thu, 29 Dec 2005 17:51:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949353#M103272</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-29T17:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949354#M103273</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;The Forum mangles spaces in posts.  I added a comment after the statement.  Your script should look like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;one=`cat messages.txt | grep 001 | cut -d"#" -f2`&lt;BR /&gt;valor=300&lt;BR /&gt;function hola&lt;BR /&gt;{&lt;BR /&gt;    eval echo $@&lt;BR /&gt;}&lt;BR /&gt;hola $one&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;The variable is $@ which is the whole set of arguments passed, not $1 which is only the first argument.  Run the code the way I posted it and then run it again having changed $@ to $1 to see the difference.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 29 Dec 2005 18:00:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949354#M103273</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-29T18:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949355#M103274</link>
      <description>o.k. thanks,&lt;BR /&gt;i'm going to explain you exactly how script looks like:&lt;BR /&gt;&lt;BR /&gt;File named messages:&lt;BR /&gt;001#`date=+'%Y%m%d'`=DEPURACION:=$vv=bytes=from=$hora=inicial=to=$hora=final&lt;BR /&gt;002#`date=+'%Y%m%d'`=$vv=bytes=deleted=from=$horainicial=to=$horafinal&lt;BR /&gt;003#`date=+'%Y%m%d'`=There=are=not=core=files=to=be=deleted&lt;BR /&gt;004#`date=+'%Y%m%d'`=PROBLEMS=TO=DELETE=FILES=$v=bytes=con=$r2&lt;BR /&gt;005#"CORE=FILES"&lt;BR /&gt;&lt;BR /&gt;Function:&lt;BR /&gt;function notifica&lt;BR /&gt;{&lt;BR /&gt;one=`echo $1 | sed 's/=/ /g'`&lt;BR /&gt;two=`echo $2 | sed 's/=/ /g'`&lt;BR /&gt;three=`echo $3 | sed 's/=/ /g'`&lt;BR /&gt;echo "$one" &amp;gt;&amp;gt; ${log_monitoring} #Sending message to log&lt;BR /&gt;echo "$two" | mailx -s "$three" 123456789@patito.com #Sending message to cellular&lt;BR /&gt;#echo "$three" &amp;gt; /dev/console #Sending message to server console&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;If i see $log_monitoring has:&lt;BR /&gt;..........&lt;BR /&gt;..........&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;`date +'%Y%m%d'` DEPURACION: $vv bytes from $hora inicial to $hora final&lt;BR /&gt;&lt;BR /&gt;What do i must do for format date appears correctly and not the command `date +'%Y%m%d'` ?&lt;BR /&gt;&lt;BR /&gt;Thanks, Manuales.</description>
      <pubDate>Thu, 29 Dec 2005 18:11:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949355#M103274</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-29T18:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949356#M103275</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;As I noted, you need to do something like this:&lt;BR /&gt;&lt;BR /&gt;function notifica&lt;BR /&gt;{&lt;BR /&gt;one=`echo $@ | sed 's/one/ONE/g'`&lt;BR /&gt;eval echo ${one} &amp;gt;&amp;gt; ${log_monitoring} &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Dec 2005 19:47:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949356#M103275</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-29T19:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949357#M103276</link>
      <description>Hi James !!! how are you !!!&lt;BR /&gt;thanks for your answer !!!&lt;BR /&gt;&lt;BR /&gt;look at this function, now is:&lt;BR /&gt;&lt;BR /&gt;Function:&lt;BR /&gt;function notifica&lt;BR /&gt;{&lt;BR /&gt;one=`echo $1 | sed 's/=/ /g'`&lt;BR /&gt;two=`echo $2 | sed 's/=/ /g'`&lt;BR /&gt;three=`echo $3 | sed 's/=/ /g'`&lt;BR /&gt;eval echo $one &amp;gt;&amp;gt; ${log_monitoring} #Sending message to log&lt;BR /&gt;eval echo $two | mailx -s "$three" 123456789@patito.com #Sending message to cellular&lt;BR /&gt;eval echo $three &amp;gt; /dev/console #Sending message to server console&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;You have already taught how execute a string !!&lt;BR /&gt;really thank you very much !!!&lt;BR /&gt;&lt;BR /&gt;Manuales.&lt;BR /&gt;God Bless you !!&lt;BR /&gt;&amp;lt;&amp;gt;&amp;lt;</description>
      <pubDate>Fri, 30 Dec 2005 12:55:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949357#M103276</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-30T12:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using a file with messages and using in the message with commands in a function ...</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949358#M103277</link>
      <description>Thanks James !!!</description>
      <pubDate>Fri, 30 Dec 2005 12:58:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-a-file-with-messages-and-using-in-the-message-with/m-p/4949358#M103277</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-30T12:58:53Z</dc:date>
    </item>
  </channel>
</rss>

