DEV Community

Discussion on: Writing Bash Scripts Like A Pro - Part 1 - Styling Guide

Collapse
 
indreias profile image
Ioan Indreias

I'm usually set environment variables for the Bash scripts (or any other executable) like:
$ USER_NAME="Julia" USER_AGE="36" good_vibes.sh

Collapse
 
psvpl profile image
Piotr Szeptynski

Me too. That's better than exporting them to the env.

Collapse
 
unfor19 profile image
Meir Gabay

Depends on the context ...
For local usage, sure, that works great.

For CI/CD processes, usually, values/secrets are injected with env vars ...

My mindset - fetch default values from env vars. A matter of approach/opinion I guess