首页 > 解决方案 > 用 bash 脚本中的值替换 phantom js 中的 YAML

问题描述

有一个静态yaml文件。我在 phantom js 驱动程序中运行一些测试。我定义了两个 URL,一个用于暂存版本,另一个用于生产版本。
YAML 文件看起来像

browser:
  chromejs: "phantomjs"
# we've deliberately left out the snap_file
resize_or_reload: 'reload'  
# Type the name of the directory that shots will be stored in
directory: 'compare/alohavillas'
#before snap
before_capture: 'templates/javascript/wait--phantom.js'
# Add only 2 domains, key will act as a label
domains:
  Production: "https://www.google.com"
  Staging: "https://www.staging-google.com" # i want to make this like dynamic

问题是,我想从 bash 文件中获取动态值暂存站点地址

暂存网址.sh

#!/bin/bash
urlvalue="https://www.staging-google.com"
echo $urlvalue

如何从 bash 文件中读取值?

标签: bashphantomjs

解决方案


推荐阅读