Skip to content

Instantly share code, notes, and snippets.

@joao-aguizo
Created March 2, 2022 20:23
Show Gist options
  • Save joao-aguizo/6622577f5ac8662deb26369943853ef4 to your computer and use it in GitHub Desktop.
Save joao-aguizo/6622577f5ac8662deb26369943853ef4 to your computer and use it in GitHub Desktop.
Shebang to make yaml executable (self-parsing in this case)
#!/bin/sh
python -c 'import yaml; import sys; print yaml.dump(yaml.load(sys.stdin), default_flow_style=False)'<<EOF
%YAML 1.1
---
receipt: Oz-Ware Purchase Invoice
date: 2007-08-06
customer:
given: Dorothy
family: Gale
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
- part_no: E1628
descrip: High Heeled "Ruby" Slippers
size: 8
price: 100.27
quantity: 1
bill-to: &id001
street: |
123 Tornado Alley
Suite 16
city: East Centerville
state: KS
ship-to: *id001
specialDelivery: >
Follow the Yellow Brick
Road to the Emerald City.
Pay no attention to the
man behind the curtain.
...
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment