- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
include.sh
#!/bin/bash -
export gg
f() {
for i in "${gg[@]}"
do
echo $i
done
}
run.sh
#!/bin/bash -
set -o nounset
. include.sh || exit 1
f
我收到这个错误
scripts/include.sh: line 5: gg[@]: unbound variable
难道 export
关键字不应该使 gg 全局化并在任何地方可用吗?如果不是,如何通过 include.sh
让 gg 在任何地方都可用?
更新
环境:
$ cat /etc/*-release
NAME="SLES"
VERSION="11.4"
VERSION_ID="11.4"
PRETTY_NAME="SUSE Linux Enterprise Server 11 SP4"
最佳答案
旧版 Unix shell 不支持 ()
数组。您应该使用 bash
调用脚本,它们将按预期运行。
正如更新后的问题中所写,您需要在导出之前定义 gg
:
gg=()
export gg
我测试了这个补丁,它工作正常。
关于linux - 虽然 export gg 我得到了未绑定(bind)的变量 gg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47835626/
include.sh #!/bin/bash - export gg f() { for i in "${gg[@]}" do echo $i done } r
我的 ggplot 有问题,我想为某些值设置不同的形状。但是在图例中,所有东西都堆叠在一起,因此图例不再清晰。此外,我想从图例中删除日本或找到另一种方法将其设置为红色且形状=17。也许添加到过滤器 J
我正在使用 footable library用于显示表。每行都有一个日期列,我想按日期列(在列标题上单击)对该表进行排序。 Data Scadenza Titolo
当我尝试构建我的项目时,它返回以下错误: 错误 1 意外错误创建调试信息文件 'D:\Documents\Lance\Documents\School\Capstone\GG\GG\obj\Deb
我试图做到这一点: var curr = new Date; var first = curr.getDate() - curr.getDay(); var last = f
例如,假设我正在 Vim 中愉快地编辑文档,这时我不小心按下了 gg。然后我最终到达文档的第一行,当然我不知道我上次编辑的确切行是哪一行。有什么方法可以神奇地回到 gg 跳转之前最后编辑的行吗? 最佳
当我尝试使用 gg=G 修复 HTML 文件的缩进时,每一行都失去了缩进并变为左对齐。有人知道这里会发生什么吗? 测试.html Indent test
我正试图弄清楚如何解决这个问题。它没有打印任何内容,也没有发送 DM。 代码: async def on_dbl_vote(self, ctx, data): print("Recei
我正在尝试使用一个新类来扩展 ggplot2,我们将在本例中将其称为 foo。目标是编写一个 +.foo 方法来代替 +.gg。但是我遇到了“不兼容方法”的问题 设置 目前我可以编写 ggplot_a
全面警告:react-dom.development.js:2592 指定的值“”不符合要求的格式。格式为“#rrggbb”,其中 rr、gg、bb 是两位十六进制数。 代码运行良好。它正在做它应该做
我正在尝试使用一个新类来扩展 ggplot2,我们将在本例中将其称为 foo。目标是编写一个 +.foo 方法来代替 +.gg。但是我遇到了“不兼容方法”的问题 设置 目前我可以编写 ggplot_a
全面警告:react-dom.development.js:2592 指定的值“”不符合要求的格式。格式为“#rrggbb”,其中 rr、gg、bb 是两位十六进制数。 代码运行良好。它正在做它应该做
我正在尝试用 HTML5 制作一个多人游戏。我找到了 lance.gg 并四处游玩。我像这样修改了 Pong 游戏。 移除 Paddle(只剩下 Ball) 将重力设置为 (0, 0.1) 设置Bal
我正在尝试为 Oracle Golden Gate (12c) 配置 BigQuery 适配器。但不幸的是我无法理解这个gg.classpath。在文档中,他们提到从 GitHub 下载客户端库 但是
我的最终目标是使用 gg=G 自动缩进符合 eslintrc.js 文件的所有 JS 代码。 所以,目前我有 syntastic和 vim-javascript在我的 .vimrc 中查看我的 JS
我使用存储过程来检查表中是否存在名称,方法是使用以下代码片段.. BEGIN IF ids = 0 THEN SELECT * FROM table_name WHERE `table_id` = a
我想用 css 选择 child 的最后一个 该文本出现gg我只想选择 Last gg 请帮忙 ul { margin: 0; padding: 0; } .container ul li +
我试图运行一段非常简单的代码,以便为作业创建ggplot。我是R的新手,所以我怀疑这是一个简单的问题,但现在我只是在努力。我的教授实际上写了这段代码,并且已经为其他与我交谈过的学生工作过。但是,我遇到
通常,人们在 vim 中使用 gg=G 来自动切换 C/C++/Java 代码或实际上任何类型的代码。 但是,我在 vim 的默认设置中将 tabstop 变量更改为 tabstop=2,这样每当我按
我使用这段代码将数据导出到一个 csv 文件并且它有效: project_id = 'project_id' client = bigquery.Client() dataset_id = 'data
我是一名优秀的程序员,十分优秀!