macros - Tera Term 宏字符串中的转义字符?

标签 macros terminal

我正在编写一个 Tera Term 宏,我需要分配一个包含 '" 的字符串变量。我已经查看了各种教程,但无法'没有找到关于如何做到这一点的提及,所以希望它存在。

这些字符串变量不起作用:

hello = "command1 argument1 "foo/hello/world.txt""
world = 'command2 argument2 'bar/hello/world.txt''

给出的语法错误: enter image description here


通过实验,我发现可以混合和匹配单引号和双引号,以便允许其中之一,但不能同时允许两者。

这些字符串变量有效:

foo = "command1 argumen1t 'foo/hello/world.txt'"
bar = 'command2 argument2 "bar/hello/world.txt"'

最佳答案

我不确定字符串是否有转义字符(我搜索过但没有找到任何相关内容),但是我找到了一种方法来解决这个问题。我并不是说这是正确的方法,但至少它可能适合您的情况。

为了发送报价,我使用了 sendln 的 ASCII 值功能。 (send 函数中的实际文档)

FILE1='foo/hello/world.txt'
FILE2='bar/hello/world.txt'
sendln 'command1 argument1 ' 34 FILE1 34
sendln 'command2 argument2 ' 39 FILE2 39

测试上述宏会在终端中输入以下内容

command1 argument1 "foo/hello/world.txt"
command2 argument2 'bar/hello/world.txt'

关于macros - Tera Term 宏字符串中的转义字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25450692/

相关文章:

字符串化变量的 C 宏

visual-studio - IntelliSense 解析时是否定义了宏?

amazon-web-services - 如何获得AWS ec2服务器允许保存文件的权限?

linux - 如何在 linux 系统上获取可在 .Xresources 配置中使用的有效字体名称?

visual-studio-code - 如何在 VS Code 中创建 "terminal configuration macro"?轻松打开和拆分多个终端

c++ - "Searching Taps"对 HomeBrew 意味着什么?

file - 在终端中合并 M4A 文件

c++ - 用一个宏创建两个不同的代码块

rust - 具有相同分隔符的并排宏重复

c++ - 在 printf 中使用可以扩展为整数或无值的 MACROS