Skip to content

Instantly share code, notes, and snippets.

@ljyloi
Created February 14, 2023 09:17
Show Gist options
  • Save ljyloi/423350245ad966a374e6e7c761cd2ee7 to your computer and use it in GitHub Desktop.
Save ljyloi/423350245ad966a374e6e7c761cd2ee7 to your computer and use it in GitHub Desktop.
利用 bash 通过模版文件生成最终文件
#!/bin/bash
export sample="Hello Yaml!"
export nats_machines="10.2.3.4"
export nats_username="nats"
export nats_password="password"
rm -f final.yml temp.yml
( echo "cat <<EOF >final.yml";
cat template.yml;
echo "EOF";
) >temp.yml
. temp.yml
cat final.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment