1  doubel quotes

  This allows substitutions to occur within the quotations - or "interpolation". The substituted group is then evaluated as a single argument.

puts "The current stock value is $varName" 

  In general, the backslash (\) disables substitution for the single character immediately following the backslash. Any character immediately following the backslash will stand without substitution.

  The final exception is the backslash at the end of a line of text. This causes the interpreter to ignore the newline, and treat the text as a single line of text. The interpreter will insert a blank space at the location of the ending backslash.

 set Z Jinan
set Z_LABEL "The Capitol of Shandong is: " puts "$Z_LABEL $Z" ;# Prints the value of Z
puts "$Z_LABEL \$Z" ;# Prints a literal $Z puts "\nBen Franklin is on the \$100.00 bill" set a 100.00
puts "Washington is not on the $a bill" ;# This is not what you want
puts "Lincoln is not on the $$a bill" ;# This is OK
puts "Hamilton is not on the \$a bill" ;# This is not what you want
puts "Ben Franklin is on the \$$a bill" ;# But, this is OK puts "\n................. examples of escape strings"
puts "Tab\tTab\tTab"
puts "This string prints out \non two lines"
puts "This string comes out\
on a single line"

2  braces

  Double braces disables substitution within braces. Characters within braces are passed to a command exactly as written.

  The only "Backslash Sequence" that is processed within braces is the backslash at the end of a line. This is still a line continuation character.

 set Z Albany
set Z_LABEL "The Capitol of New York is: " puts "\n................. examples of differences between \" and \{"
puts "$Z_LABEL $Z"
puts {$Z_LABEL $Z} puts "\n....... examples of differences in nesting \{ and \" "
puts "$Z_LABEL {$Z}"
puts {Who said, "What this country needs is a good $0.05 cigar!"?} puts "\n................. examples of escape strings"
puts {There are no substitutions done within braces \n \r \x0a \f \v}
puts {But, the escaped newline at the end of a\
string is still evaluated as a space}

3  square brackets

  We obtain the results of a command by placing the command in square brackets ([]). This is the functional equivalent of the back single quote (`) in sh programming, or using the return value of a function in C.

  As the Tcl interpreter reads in a line it replaces all the $variables with their values. If a portion of the string is grouped with square brackets, then the string within the square brackets is evaluated as a command by the interpreter, and the result of the command replaces the square bracketed string.

  The exceptions to this rule are as follows:

  1)  A square bracket that is escaped with a \ is considered as a literal square bracket.

  2)  A square bracket within braces is not modified during the substitution phase.

 set x abc
puts "A simple substitution: $x\n" set y [set x "def"]
puts "Remember that set returns the new value of the variable: X: $x Y: $y\n" set z {[set x "This is a string within quotes within braces"]}
puts "Note the curly braces: $z\n" set a "[set x {This is a string within braces within quotes}]"
puts "See how the set is executed: $a"
puts "\$x is: $x\n" set b "\[set y {This is a string within braces within quotes}]"
# Note the \ escapes the bracket, and must be doubled to be a
# literal character in double quotes
puts "Note the \\ escapes the bracket:\n \$b is: $b"
puts "\$y is: $y"

Tcl之group arguments的更多相关文章

  1. uC/OS-II标志(flag)块

    /*************************************************************************************************** ...

  2. springboot情操陶冶-web配置(七)

    参数校验通常是OpenApi必做的操作,其会对不合法的输入做统一的校验以防止恶意的请求.本文则对参数校验这方面作下简单的分析 spring.factories 读者应该对此文件加以深刻的印象,很多sp ...

  3. 【深度学习】吴恩达网易公开课练习(class1 week4)

    概要 class1 week3的任务是实现单隐层的神经网络代码,而本次任务是实现有L层的多层深度全连接神经网络.关键点跟class3的基本相同,算清各个参数的维度即可. 关键变量: m: 训练样本数量 ...

  4. Neural Networks and Deep Learning(week4)Deep Neural Network - Application(图像分类)

    Deep Neural Network for Image Classification: Application 预先实现的代码,保存在本地 dnn_app_utils_v3.py import n ...

  5. Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step

    Building your Deep Neural Network: Step by Step 你将使用下面函数来构建一个深层神经网络来实现图像分类. 使用像relu这的非线性单元来改进你的模型 构建 ...

  6. 课程一(Neural Networks and Deep Learning)总结——2、Deep Neural Networks

    Deep L-layer neural network 1 - General methodology As usual you will follow the Deep Learning metho ...

  7. 课程一(Neural Networks and Deep Learning),第四周(Deep Neural Networks)——2.Programming Assignments: Building your Deep Neural Network: Step by Step

    Building your Deep Neural Network: Step by Step Welcome to your third programming exercise of the de ...

  8. C++ Core Guidelines

    C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very ...

  9. 运维利器1-supervisor

    supervisor用来管理进程服务很方便 优点: 1.重启方便,无抖动感 2.可以分组管理进程 3.加入系统自动启动后,可以开机自启,程序异常退出能自动启动 操作: 1.在python沙箱环境下操作 ...

随机推荐

  1. jenkins-slave的搭建和使用

    一 什么是Jenkins的分布式构建和部署 Jenkins的分布式构建,在Jenkins的配置中叫做节点,分布式构建能够让同一套代码或项目在不同的环境(如:Windows和Linux系统)中编译.部署 ...

  2. (5)XML转化成TXT

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Tex ...

  3. 加密解密(5)SSL形象比喻

    转自: http://blog.csdn.net/cloverphp/article/details/11737433 前言: 关于公钥,私钥请看前几篇文章   SSL 协议既用到了公钥加密技术(握手 ...

  4. .net类库中和数据库相关的

    System.Data.SqlTypes SqlDbType 枚举类型 Specifies SQL Server-specific data type of a field, property, fo ...

  5. MSAA, UIA brief explanation

    MSAA, UIA brief explanation 2014-07-24 Reference [1] MSAA, UIA brief explanation [2] Testing Tools [ ...

  6. Android实现ExpandableTextView可扩展TextView

    介绍 在应用开发中,总会遇到一些类似于公告,说明等长文本的TextView,但是为了排版美观等因素,我们通常是要隐藏后半部的文本,只显示部分文字,然后在尾部会提供用户一个扩展/收缩的按钮,使得文本框可 ...

  7. Velocity模板中的注释

    Velocity ——VTL模板中的注释 注释允许在模板中包含描述文字,而这些文字不会被放置到模板引擎的输出中.注释是一种有效的提醒自己和向别人解释你的VTL语句要做什么事情的方法.你也可以把注释用来 ...

  8. Incorrect key file for table '/tmp/#sql_882_0.MYI'; try to repair it

    修表方法如下: 一法:. check table 和 repair table 方法1,进入Mysql 的Dos控制台,输入密码进入 2,use database;(你的数据库名) 3, check  ...

  9. 常见NoSQL的特点分析与比较

    3.分类: 3.1(最常见的键值存储) a.临时性的:保存在内存中,可以进行快速的保存和读取操作, 数据有可能丢失 b.永久性:在磁盘上保存数据,可以进行快读的读写(没有内存中快),数据不会丢失 c. ...

  10. HDU 1527 (Wythoff 博弈) 取石子游戏

    对于Wythoff博弈中的两个数列,An和Bn有这样的关系: An + n = Bn, An = floor(φ * n) 所以我们可以根据a b的差值来计算一个新的a出来看看这两个值是否相等. 想等 ...