使用bash read命令检索多个单词

使用bash read命令检索多个单词,bash,Bash,我正在编写一个bash脚本,我有以下内容: #!/bin/bash echo Enter some text read tweet t update $tweet 我使用t update命令将sferikt安装到tweet,我想将多个单词传递到$tweet变量中,但我收到了此消息 ERROR: "t update" was called with arguments ["sdfs", "sdfsdf"] Usage: "t update [MESSAGE]" 您需要引用变量,以便将其作

我正在编写一个bash脚本,我有以下内容:

#!/bin/bash  
echo Enter some text
read tweet
t update  $tweet
我使用
t update
命令将sferik
t
安装到tweet,我想将多个单词传递到
$tweet
变量中,但我收到了此消息

ERROR: "t update" was called with arguments ["sdfs", "sdfsdf"]
Usage: "t update [MESSAGE]"

您需要引用变量,以便将其作为单个参数传递给
t

t update "$tweet"

一般来说,总是引用你的变量,除非你确切知道为什么不应该引用。

问题不是关于
阅读
,而是关于引用;任何基本的Bash介绍都会在关于引用的章节的第一句中解释这一点。我现在得到了这个错误/Library/Ruby/Gems/2.0.0/Gems/thor-0.19.1/lib/thor/parser/arguments。rb:12:in‘block in split’:UTF-8中的无效字节序列(ArgumentError)您的区域设置是什么<代码>环境| grep^LC;echo$LANG