<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/9326" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2005-03-14T00:56:54-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/9326</id>

		<entry>
		<author><name><![CDATA[BinaryBob]]></name></author>
		<updated>2005-03-14T00:56:54-04:00</updated>

		<published>2005-03-14T00:56:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47611#p47611</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47611#p47611"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47611#p47611"><![CDATA[
Woohoo! Double quotes it is!<br><br>Thank you very much.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6069">BinaryBob</a> — Mon Mar 14, 2005 12:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-03-14T00:53:51-04:00</updated>

		<published>2005-03-14T00:53:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47610#p47610</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47610#p47610"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47610#p47610"><![CDATA[
well you may need that bash after all hehe... expanding * metachar<br><br>try your /bin/bash -c with double quotes<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Mar 14, 2005 12:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BinaryBob]]></name></author>
		<updated>2005-03-14T00:38:41-04:00</updated>

		<published>2005-03-14T00:38:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47608#p47608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47608#p47608"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47608#p47608"><![CDATA[
Mistake on my part, when i did your first modification, i didn't incldue the *, duh.<br><br>So I fixed that, included your catch lines.<br><br>And the error is now:<br><div class="codebox"><p>Code: </p><pre><code>&lt;ADMINBOT&gt; [20:33] Tcl error [lookup_string]: grep: /home/eggdrop/eggdrop/logs/sdcara.log*: No such file or directory</code></pre></div>It seems to take the wildcard literally...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6069">BinaryBob</a> — Mon Mar 14, 2005 12:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-03-14T00:15:51-04:00</updated>

		<published>2005-03-14T00:15:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47602#p47602</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47602#p47602"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47602#p47602"><![CDATA[
grep(1) returns 1 if no matches were found, and any return code but 0 means "abnormal program termination"<br><br>so you need to catch the error and continue:<div class="codebox"><p>Code: </p><pre><code>if ![catch {exec /bin/grep -i $args /path/$chan.log*}] {  # match(es) found, do your stuff } else {  # no matches}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Mon Mar 14, 2005 12:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BinaryBob]]></name></author>
		<updated>2005-03-13T23:53:59-04:00</updated>

		<published>2005-03-13T23:53:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47600#p47600</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47600#p47600"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47600#p47600"><![CDATA[
Thank you!<br>Ok, some progress. Now I get this error<br><div class="codebox"><p>Code: </p><pre><code>&lt;ADMINBOT&gt; [19:51] Tcl error [lookup_string]: child process exited abnormally</code></pre></div>Ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6069">BinaryBob</a> — Sun Mar 13, 2005 11:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-03-13T23:48:26-04:00</updated>

		<published>2005-03-13T23:48:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47599#p47599</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47599#p47599"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47599#p47599"><![CDATA[
no need to fork bash; also get rid of those single quotes:<div class="codebox"><p>Code: </p><pre><code>exec /bin/grep -i $args /path/$chan.log*</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sun Mar 13, 2005 11:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BinaryBob]]></name></author>
		<updated>2005-03-13T23:32:59-04:00</updated>

		<published>2005-03-13T23:32:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=47598#p47598</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=47598#p47598"/>
		<title type="html"><![CDATA[exec, grep, and shells oh my]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=47598#p47598"><![CDATA[
I'm trying to create a script that will let me lookup text in log files. I figured using grep externally would provide me with alot of flexability. I got it working, but it only works using one file, and I'm having my log files divided out by day, so I want to use the wildcard * liek I do on a shell to have grep lookinto all of them. Here's the code for the wildcard version:<br><div class="codebox"><p>Code: </p><pre><code>bind pub - {??} lookup_stringproc lookup_string {nick host handle chan args} {        putquick "NOTICE $nick :Looking up: $args"        set chanmod [string trimleft $chan #]             set out [exec /bin/bash -c 'grep -i $args /home/eggdrop/eggdrop/logs/[string tolower $chanmod].log*']        set arr [split $out \n]        foreach line $arr {                putquick "NOTICE $nick :$line"        }}putlog "FlashBack loaded."</code></pre></div>The error I get when DCCed into eggdrop is:<div class="codebox"><p>Code: </p><pre><code>&lt;ADMINBOT&gt; [19:35] Tcl error [lookup_string]: -i: -c: line 1: unexpected EOF while looking for matching `''&lt;ADMINBOT&gt; -i: -c: line 2: syntax error: unexpected end of file</code></pre></div>The command : /bin/bash -c 'grep -i $args /home/eggdrop/eggdrop/logs/[string tolower $chanmod].log*' works in the shell tho if im logged in. (after fixing up the varible parts of course)<br><br>Anyone have any ideas to make this work? Or... If i cant do that i could have 1 log file, which I know how to, but is there a way to change the timestamps to include the ddMMMyy date along with the time? I didnt see an option for that in the conf.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6069">BinaryBob</a> — Sun Mar 13, 2005 11:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
