⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l-tcl-3-3.html

📁 fish小程序 fish小程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</table>
<TABLE width="100%" cellspacing="0" cellpadding="0" border="0">
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#cc6633" height="3" width="150"><IMG src="../i/c.gif" width="150" height="3"></TD>
</TR>
<TR>
<TD bgcolor="#333333" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#000000" height="1" width="150"><IMG src="../i/c.gif" width="150" height="1"></TD>
</TR>
<TR>
<TD bgcolor="#ffffff" height="1" width="150"><IMG src="../i/c.gif" width="150" height="2"></TD>
</TR>
</TABLE>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Verdana, sans-serif" size="-1"><a href="http://www.ibm.com/">IBM</a> : <a href="/developerWorks/index.shtml">developerWorks 中国网站</a> : <a href="/developerWorks/linux/index.shtml">Linux</a> : <a href="/developerWorks/cnedu.nsf/linux-onlinecourse-bytitle">教学 - 在线教程</a></font>
<br>
<img src="imagemaster/masthead.jpg" alt="Tcl/Tk quick start"></td><td width="*" valign="bottom" align="right"><a border="0" href="l-tcl.zip"><img alt="下载 ZIP 文件" border="0" src="../i/icon-zip.gif"></a>
					&nbsp;&nbsp;&nbsp;
				</td>
</tr>
<tr>
<td height="2" colspan="2"><img height="2" width="1" src="../i/c.gif"></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜单" border="0" src="../i/main.gif" name="topmain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index3.html"><img alt="章节菜单" border="0" src="../i/section.gif" name="topsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="l-tcl-7-2.html"><img alt="给出此教程的反馈意见" border="0" src="../i/feedback.gif" name="topfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="l-tcl-3-2.html"><img alt="上页" border="0" src="../i/previous.gif" name="topprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="l-tcl-3-4.html"><img alt="下页" border="0" src="../i/next.gif" name="topnext"></a></TD>
</TR>
</TABLE>
<table bgcolor="ffffff" cellspacing="0" cellpadding="2" border="0" height="400" width="100%">
<tr valign="bottom">
<a name="navskip"></a><td height="25" colspan="4"><img alt="3.The Tcl language" src="imagemaster/titlebar3.jpg" border="0" height="25" width="562"></td>
</tr>
<tr>
<td bgcolor="ffffff" width="15">&nbsp;</td><td BGCOLOR="ffffff" align="left" valign="top" cellspacing="0" cellpadding="0">
<pre>
<code style="font-family: Courier New, Courier, monospace; font-size: 12"> 
#!/usr/bin/tclsh
#
# Demonstrate global variables
# and backslash substitution
 
if {$argc &gt;= 1} {
    set N 1
    foreach Arg $argv {
        puts stdout "$N: $Arg\n"
        set N [expr $N + 1]
        if {$Arg == "ring"} {
            puts stdout "\a"
        }
    }
} else {
    puts stdout "$argv0 on \
        X Display $env(DISPLAY)\n"
}

***
~/tcltk$ <b>./hello3.tcl</b>
./hello3.tcl on  X Display :0.0
 
~/tcltk$ <b>./hello3.tcl ring</b>
1: ring
			</code>
</pre>
</td><td bgcolor="ffffff" width="12">&nbsp;</td><td valign="top" align="left" bgcolor="ffffff" width="*">
<p>
<br>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="90%"><font size="4" face="Verdana, Arial, Helvetica"><b>Tcl global variables and backslash substitutions</b></font></td><td width="200" align="right"><font size="1" face="Verdana, Arial, Helvetica"><nobr>   第 3 页(共15 页)</nobr></font></td>
</tr>
</table>
<br>
<br>
</p>
<font size="2" face="Verdana, Arial, Helvetica">
<p>Several global variables exist (and are pre-defined, 
				if not null in the current context) when a Tcl/Tk 
				script begins running. These variables permit access to the 
				operating environment as follows: <i>argc</i> is the count of 
				arguments to the script, not counting the name as invoked. 
				<i>argv</i> is a list (not an array) of arguments. <i>argv0</i> is the 
				invoked filename (which may be a symlink). <i>env</i> is an 
				array that is indexed by the names of the current shell's 
				environment variables. <i>errorCode</i> stores information 
				about the most recent Tcl error, while <i>errorInfo</i> contains 
				a stack trace from the same event. The list goes on with another
				dozen <i>tcl_xxx</i> variables from 
				<code>tcl_interactive</code> to <code>tcl_version</code>.
				A good summary is found in <i>Tcl/Tk in a Nutshell</i> (see 
				the Resources at the end of this tutorial for more information).</p>
<p>Several of these variables are used in the sample code at left, along with (once 
				again) some backslash-quoted characters, \n and \a.
				<code><b>\</b><i>char</i></code> allows substitution of non-printing 
				ASCII characters. This is common to many scripting and shell 
				environments under UNIX. As noted in the table, a backslash-quoted 
				character that has no defined substitution is simply echoed to output.</p>
<table border="1">
<tr>
<th align="center" width="150pt">\<i>character</i></th><th align="center" width="150pt">Substitution</th>
</tr>
<tr>
<td width="150pt"><b>\a</b></td><td width="150pt">Bell</td>
</tr>
<tr>
<td width="150pt"><b>\b</b></td><td width="150pt">Backspace</td>
</tr>
<tr>
<td width="150pt"><b>\f</b></td><td width="150pt">Formfeed</td>
</tr>
<tr>
<td width="150pt"><b>\n or \newline</b></td><td width="150pt">Newline</td>
</tr>
<tr>
<td width="150pt"><b>\r</b></td><td width="150pt">Carriage return</td>
</tr>
<tr>
<td width="150pt"><b>\t</b></td><td width="150pt">Horizontal tab</td>
</tr>
<tr>
<td width="150pt"><b>\v</b></td><td width="150pt">Vertical Tab</td>
</tr>
<tr>
<td width="150pt"><b>\space ("\ ")</b></td><td width="150pt">Space</td>
</tr>
<tr>
<td width="150pt"><b>\<i>ddd</i></b></td><td width="150pt">Octal value</td>
</tr>
<tr>
<td width="150pt"><b>\x<i>ddd</i>...</b></td><td width="150pt">Hexadecimal value</td>
</tr>
<tr>
<td width="150pt"><b>\c</b></td><td width="150pt">Echo 'c'</td>
</tr>
<tr>
<td width="150pt"><b>\\</b></td><td width="150pt">Backslash</td>
</tr>
</table>
<br>
</font></td>
</tr>
</table>
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<TR>
<TD background="../i/sw-gold.gif"><a border="0" href="index.html" onMouseOver="iOver('topmain'); iOver('bottommain'); self.status=mainblurb; return true;" onMouseOut="iOut('topmain'); iOut('bottommain'); self.status=''; return true;"><img alt="主菜单" border="0" src="../i/main.gif" name="bottommain"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topsection'); iOver('bottomsection'); self.status=sectionblurb; return true;" onMouseOut="iOut('topsection'); iOut('bottomsection'); self.status=''; return true;" href="index3.html"><img alt="章节菜单" border="0" src="../i/section.gif" name="bottomsection"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topfeedback'); iOver('bottomfeedback'); self.status=feedbackblurb; return true;" onMouseOut="iOut('topfeedback'); iOut('bottomfeedback'); self.status=''; return true;" href="l-tcl-7-2.html"><img alt="给出此教程的反馈意见" border="0" src="../i/feedback.gif" name="bottomfeedback"></a></TD><TD width="100%" background="../i/sw-gold.gif"><img src="../i/c.gif"></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topprevious'); iOver('bottomprevious'); self.status=previousblurb; return true;" onMouseOut="iOut('topprevious'); iOut('bottomprevious'); self.status=''; return true;" href="l-tcl-3-2.html"><img alt="上页" border="0" src="../i/previous.gif" name="bottomprevious"></a></TD><TD background="../i/sw-gold.gif"><a border="0" onMouseOver="iOver('topnext'); iOver('bottomnext'); self.status=nextblurb; return true;" onMouseOut="iOut('topnext'); iOut('bottomnext'); self.status=''; return true;" href="l-tcl-3-4.html"><img alt="下页" border="0" src="../i/next.gif" name="bottomnext"></a></TD>
</TR>
<TR>
<TD width="150" height="1" bgcolor="#000000" colspan="6"><IMG alt="" height="1" width="150" src="../i/c.gif"></TD>
</TR>
</TABLE>
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
<TR>
<TD width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img alt="" height="1" width="1" src="../i/c.gif"></td>
</tr>
<tr valign="top">
<td class="bbg" height="21"> <a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/index.shtml">关于 IBM</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/privacy/index.shtml">隐私条约</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/legal/index.shtml">法律条款</a><span class="divider"> | </span><a class="mainlink" href="/developerWorks/cgi-bin/click.cgi?url=http://www-900.ibm.com/cn/ibm/contact/index.shtml">联系 IBM</a></td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -