d-baranowski / Devtales-Blog

Source code for my blog.
1 stars 0 forks source link

Stdin > Stdout #61

Open d-baranowski opened 5 years ago

d-baranowski commented 5 years ago

Talk about pipes and how to embrace the awesomest of unix and how to write good utility scripts that will save you time: Today I was struggling on generating valid python to pass in as bash Eventually I gave up trying to use Sed and written a very simple python script to solve my problem. I wish I have saved myself the effort of trying to script everything in bash. Show of how you can pass Stdin to docker containers if you pass -i flag

import sys
lines = sys.stdin.readlines()

print("bitbucket-key: |-")
for line in lines:
    sys.stdout.write("  %s" % line),
aws --region ${awsRegion} ssm get-parameter --name /concourse/$(team)/bitbucket-key --with-decryption | jq -r .Parameter.Value | $(PYTHON) ./scripts/printSecret.py > /tmp/pipelines/notASecret.yml