Sublime Forum

Can I set my own variable in build system?

#1

Hi guys. I am wondering if I can set my own variable in build system? like:
ip:192.168.2.12,

then I can use this variable in the next steps.
Or I have to set it as environment variable? I feel that way sort of contaminated my system environment.

1 Like

Pass args to build command
#2

You can either create environment variables in the build system via "env": { "MYVAR": "foobar" } or write you own target command, which gets all non special fields as keyword arguments, and call exec from there.

PS. Environment variables are only set for the build system process and not global.

2 Likes

#3

You can script your build command in some scripting language such as perl or bash to avoid such issues.

1 Like

#4

Just to add to what’s already been said, this is an example of writing your own custom target command to add your own variables to build systems. if you want to go that route.

1 Like