4

I use envsubst to substitute environment variables to a file in linux.

envsubst < task-definition.json > new-task-definition.json

How to achieve this feature in windows using default resources or using a 3rd party tool?

3

I don't directly know of a built in substitute for the envsubst command in Windows. However as you've made 3rd party tools an option, I would recommend MinGW, a minimalist GNU package for Windows users. It also comes with a envsubst implementation for Windows.

CygWin could also be an option. It provides a more complete collection of GNU tools and other Open Source tools for Windows (comes also with a POSIX API for Windows for example). It should also have an envsubst but as I don't have CygWin locally I cannot confirm this.

I would go for MinGW though as the extra functionnalities CygWin provides (POSIX environment) are not needed for envsubst but the choice is up to you (this SO post and this article may help you make a decision).

-1

Packet in Ubuntu/Debian gettext-base has envsubst with same functional.

Online documentation for envsubst in gettext project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.