<?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/13797" />

	<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>2007-07-19T20:41:22-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-07-19T20:41:22-04:00</updated>

		<published>2007-07-19T20:41:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74595#p74595</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74595#p74595"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74595#p74595"><![CDATA[
<a href="http://expect.nist.gov/" class="postlink">The Expect Home Page</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Thu Jul 19, 2007 8:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-07-19T19:22:03-04:00</updated>

		<published>2007-07-19T19:22:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74594#p74594</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74594#p74594"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74594#p74594"><![CDATA[
<a href="http://www.egghelp.org/whatis.htm" class="postlink">What is an Eggdrop?</a> This is a forum specifically for Eggdrop Tcl scripting but of course other Tcl related help requests are welcome <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Jul 19, 2007 7:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[earnstaf]]></name></author>
		<updated>2007-07-19T18:46:47-04:00</updated>

		<published>2007-07-19T18:46:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74593#p74593</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74593#p74593"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74593#p74593"><![CDATA[
<blockquote class="uncited"><div>Well, if you're coding for eggdrop, you'll have to use several procs and bindings, each triggering and handling each step: ie, one proc to ask the user for input, and another for handling the response.</div></blockquote>I'm not real sure what eggdrop is... sorry!  Your guidance in tcl/expect scripting was helpful though ...<br><br>I get the user response via this code<div class="codebox"><p>Code: </p><pre><code>send_user "What file would you like to push? Press 1 for file1, 2 for file2 or 3 for both: "expect_user -re "(.*)\n" {set FILE $expect_out(1,string)} </code></pre></div>then I setup the switch as you outlined:<div class="codebox"><p>Code: </p><pre><code>switch $FILE {  1 { lots of commands }  2 { lots of commands }  3 { lots of commands }}</code></pre></div>One the user enters a number 1-3, and it's saved to the $FILE variable, it seems to work with switch to jump to the appropriate code.<br><br>Thanks for your help... it's definitely a big learning curve when going from shell scripting to tcl.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9164">earnstaf</a> — Thu Jul 19, 2007 6:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-07-19T18:39:20-04:00</updated>

		<published>2007-07-19T18:39:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74592#p74592</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74592#p74592"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74592#p74592"><![CDATA[
Well, if you're coding for eggdrop, you'll have to use several procs and bindings, each triggering and handling each step: ie, one proc to ask the user for input, and another for handling the response.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jul 19, 2007 6:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[earnstaf]]></name></author>
		<updated>2007-07-19T18:39:22-04:00</updated>

		<published>2007-07-19T18:21:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74591#p74591</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74591#p74591"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74591#p74591"><![CDATA[
<blockquote class="uncited"><div>Roughly something like this:<div class="codebox"><p>Code: </p><pre><code>switch $file { 1 {command 1} 2 {command 2} 3 - 4 {command for 3 or 4} default {any other command}}</code></pre></div>Also check the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm" class="postlink">manual for switch</a> for more info/hints...</div></blockquote>Thanks nml.  That looks like exactly what I need.<br><br>How do I prompt the user to enter the 1, 2 or 3?  Is it something like this?<div class="codebox"><p>Code: </p><pre><code>send_user "What file would you like to push? Press 1 for file1, 2 for file2 or 3 for both: "expect_user -re "(.*)\n" {set FILE $expect_out(1,string)}</code></pre></div>Seems to be working the way I have it setup.. if there is a better way, please let me know.<br><br>Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9164">earnstaf</a> — Thu Jul 19, 2007 6:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-07-19T17:33:37-04:00</updated>

		<published>2007-07-19T17:33:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74590#p74590</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74590#p74590"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74590#p74590"><![CDATA[
Roughly something like this:<div class="codebox"><p>Code: </p><pre><code>switch $file { 1 {command 1} 2 {command 2} 3 - 4 {command for 3 or 4} default {any other command}}</code></pre></div>Also check the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm" class="postlink">manual for switch</a> for more info/hints...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jul 19, 2007 5:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[earnstaf]]></name></author>
		<updated>2007-07-19T17:26:15-04:00</updated>

		<published>2007-07-19T17:26:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74589#p74589</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74589#p74589"/>
		<title type="html"><![CDATA[Case Structure Equivalent?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74589#p74589"><![CDATA[
Hi all,<br>I'm very new to tcl/expect and I'm looking for a push in the right direction on this issue.  I'm writing an expect script to log into a router and push a file that varies.  I was thinking of using something like a case structure in shell scripting:<div class="codebox"><p>Code: </p><pre><code>echo -n "What file would you like to push? Press 1 for file1, 2 for file2 or 3 for both: "; read filecase $file in  1) [i]expect and send commands for file1[/i] ;;  2) [i]expect and send commands for file2[/i];;  3) etc...esac</code></pre></div>Is there an efficient way to do this with expect/tcl?  Or can I write the script as a shell script, call the Expect script and use the shell variables within the expect script?<br><br>Thanks for any guidance you can provide.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9164">earnstaf</a> — Thu Jul 19, 2007 5:26 pm</p><hr />
]]></content>
	</entry>
	</feed>
