【问题标题】:Found an issue when use config file for my shell script为我的 shell 脚本使用配置文件时发现问题
【发布时间】:2023-01-12 12:00:53
【问题描述】:

配置文件

fruit-list="apple, pear, banana, watermelon"

脚本

source /configure.conf

然后显示错误: /configure.conf: 第 2 行:fruit-list=apple, pear, banana, watermelon: command not found

有人可以帮我弄清楚为什么会这样吗?

我希望 fruit-list 可以是 shell 脚本中的列表数据类型,与

fruit-list="apple" "pear" "banana" "watermelon"

请帮我解决这个问题。

【问题讨论】:

    标签: shell configuration


    【解决方案1】:

    bash 中的标识符不能包含-。请改用fruit_list=...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      相关资源
      最近更新 更多